承接 arnolem/tailwindphp 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arnolem/tailwindphp

Composer 安装命令:

composer require arnolem/tailwindphp

包简介

TailwindPHP - use Tailwind CSS in your PHP projects (without npm)

README 文档

README

TailwindPHP - use Tailwind CSS in your PHP projects (without npm)

Tailwind PHP allows you to compile TailwindCSS on the fly directly with PHP without dependencies (without npm or postcss).

Installing

IMPORTANT : Alpha version required linux x64.

PHP 8.0+ and Composer are required.

composer req arnolem/tailwindphp

Add execution rights

chmod +x ./vendor/arnolem/tailwindphp/bin/*

Configuration

1- create a tailwind.config.js config file

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./templates/**/*.twig"],
  theme: {
    extend: {},
  },
  plugins: [],
}

2-Add a link to the css route

<!-- base.html.twig -->
<!doctype html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="{{ path('css') }}" >
<!-- //... -->

3-Create a css route with TailwindPhp

<?php
// src/Controller/CssController.php
namespace App\Controller;

use Arnolem\TailwindPhp\TailwindPhp;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class CssController
{
    #[Route(path: 'style.css', name: 'css')]
    public function index(): Response
    {
        return new Response(
            TailwindPhp::build(),
            Response::HTTP_OK,
            ['Content-Type' => 'text/css']
        );
    }
}

Optional-Enable SCSS compilation

<?php
// src/Controller/CssController.php
namespace App\Controller;

use Arnolem\TailwindPhp\TailwindPhp;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class CssController
{
    #[Route(path: 'style.css', name: 'css')]
    public function index(): Response
    {
        TailwindPhp::enableScss(true);
        
        $scss = 'YOUR_SCSS_CONTENT with @apply ou theme() function';
        
        return new Response(
            TailwindPhp::build($scss),
            Response::HTTP_OK,
            ['Content-Type' => 'text/css']
        );
    }
}

Credits

  • Arnaud Lemercier is based on Wixiweb.

License

TailwindPHP is licensed under The MIT License (MIT).

统计信息

  • 总下载量: 26.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固