定制 winter/wn-tailwindui-plugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

winter/wn-tailwindui-plugin

Composer 安装命令:

composer require winter/wn-tailwindui-plugin

包简介

Provides a TailwindUI-based skin for the Winter CMS backend.

README 文档

README

Tailwind_UI_Plugin

MIT License

Tailwind UI is a Tailwind CSS component library designed by the authors of Tailwind CSS. This is a Winter CMS plugin that provides a custom, TailwindUI-based skin for the backend.

Supports:

  • Multiple authentication page layouts (Simple, Left Sidebar)
  • Backend Menu location customization (Top, Side)
  • Backend Menu Icon location customization (Above, Beside, Hidden (Text Only), Only (No Text))
  • Background image for login page
  • Dark mode

Installation

This plugin is available for installation via Composer.

composer require winter/wn-tailwindui-plugin

After installing the plugin you will need to run the migrations and (if you are using a public folder) republish your public directory.

php artisan migrate

Screenshots

Before After
stock-winter tailwind-ui-light

Dark Mode!

Dark mode and user preferences are also supported.

tailwind-ui-dark

tailwind-preferences

Getting started

Use composer to install the plugin:

composer require winter/wn-tailwindui-plugin

Then, run the migrations to ensure the plugin is enabled:

php artisan migrate

Configuration

Configuration for this plugin is handled through a configuration file. In order to modify the configuration values and get started you can either add the values to your .env environment file or copy the plugins/winter/tailwindui/config/config.php file to config/winter/tailwindui/config.php and make your changes there.

Environment File Supported Values:

  • TAILWIND_SHOW_BREAKPOINT_DEBUGGER=false

Using Tailwind in other Plugins

The following steps should be taken in order to ensure the best compatibility between plugins when using Tailwind with other plugins in the Backend:

  • Use Laravel Mix to handle compiling your plugin's Tailwind styles
  • In your tailwind.config.js file, take the following actions:
    • Extend the Winter.TailwindUI plugin's configuration rather than the default Tailwind configuration (ex: const config = require('../../winter/tailwindui/tailwind.config.js');).
    • Ensure that the Preflight Tailwind plugin is disabled (ex: config.corePlugins = {preflight: false};).
    • Set config.content to include only your plugin's paths (ex: config.content = ['./formwidgets/**/*.{vue,php,htm}', './components/**/*.{php,htm}', './assets/src/js/**/*.{js,vue}'];).
  • In your package.json file, include postcss-prefixwrap to wrap your plugin's generated styles in a plugin-specific class to prevent overriding the styles elsewhere in the backend (ex. "postcss-prefixwrap": "~1.29.x",).
  • In your winter.mix.js file, use postcss-prefixwrap when compiling the Tailwind styles (ex. mix.postCss('assets/src/css/example.css', 'assets/dist/css/example.css', [..., require('postcss-prefixwrap')('.plugin-authorname-pluginname'), ...])).

Example tailwind.config.js:

// Extend the base tailwind config to avoid conflicts
const config = require('../../winter/tailwindui/tailwind.config.js');

config.content = [
    './formwidgets/**/*.{vue,php,htm}',
    './components/**/*.{php,htm}',
    './assets/src/js/**/*.{js,vue}',
];

config.corePlugins = {
    preflight: false,
};

module.exports = config;

Example winter.mix.js:

const mix = require('laravel-mix');

mix.setPublicPath(__dirname)

    // Compile Tailwind
    .postCss(
        'assets/src/css/myplugin.css',
        'assets/dist/css/myplugin.css',
        [
            require('postcss-import'),
            require('tailwindcss/nesting'),
            require('tailwindcss'),
            require('autoprefixer'),
            require('postcss-prefixwrap')('.myauthor-pluginname', {
                // Don't prefix wrap modals because we can't put the wrapping class on a high enough parent element to apply the styles
                ignoredSelectors: ['.modal'],
            })
        ]
    );

Example package.json:

{
    "name": "myauthor-pluginname",
    "version": "0.0.1",
    "private": true,
    "version": "1.0.0",
    "devDependencies": {
        "postcss": "~8.4.x",
        "postcss-prefixwrap": "~1.29.x",
        "postcss-import": "~14.1.x",
        "tailwindcss": "~3.0.x",
        "@tailwindcss/typography": "0.5.8"
    }
}

Future Ideas

It would be ideal if it was also possible for other plugins to detect the classes that have already been generated by this plugin and prune them from their compiled styles. Pull Requests welcome to add that ability in the future if anyone has the time / motivation to do so.

Credits

This plugin was originally written by Joseph Blythe & Luke Towers for Spatial Media.

It has since been modified and re-released under the Winter namespace as a first party plugin for Winter CMS maintained by the Winter CMS team.

If you would like to contribute to this plugin's development, please feel free to submit issues or pull requests to the plugin's repository here: https://github.com/wintercms/wn-tailwindui-plugin

If you would like to support Winter CMS, please visit WinterCMS.com

winter/wn-tailwindui-plugin 适用场景与选型建议

winter/wn-tailwindui-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.5k 次下载、GitHub Stars 达 19, 最近一次更新时间为 2022 年 06 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cms」 「skin」 「tailwind」 「tailwindui」 「wintercms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 winter/wn-tailwindui-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 winter/wn-tailwindui-plugin 我们能提供哪些服务?
定制开发 / 二次开发

基于 winter/wn-tailwindui-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 16.5k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 19
  • Watchers: 4
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-28