All Projects → pcdotfan → taro-plugin-tailwind

pcdotfan / taro-plugin-tailwind

Licence: MIT license
Taro 接入 windicss / tailwindcss 插件

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to taro-plugin-tailwind

vite-react-ts-tailwind-firebase-starter
Starter using Vite + React + TypeScript + Tailwind CSS. And already set up Firebase(v9), Prettier and ESLint.
Stars: ✭ 108 (+38.46%)
Mutual labels:  tailwind, tailwindcss
tailwindcss-fluid-type
A plugin that makes the use of Fluid Type a breeze.
Stars: ✭ 91 (+16.67%)
Mutual labels:  tailwind, tailwindcss
wrapped
GitHub Wrapped, inspired by Spotify Wrapped
Stars: ✭ 159 (+103.85%)
Mutual labels:  tailwind, tailwindcss
tailwind
🧛🏻‍♂️ Dark theme for Tailwind
Stars: ✭ 25 (-67.95%)
Mutual labels:  tailwind, tailwindcss
Awesome Tailwindcss
😎 Awesome things related to Tailwind CSS
Stars: ✭ 7,791 (+9888.46%)
Mutual labels:  tailwind, tailwindcss
hepsiburada
Hepsiburada.com Tailwind/VueJS/CSS Clone
Stars: ✭ 39 (-50%)
Mutual labels:  tailwind, tailwindcss
css-to-tailwind
Convert plain CSS to TailwindCSS classes. Demo: https://transform.tools/css-to-tailwind
Stars: ✭ 19 (-75.64%)
Mutual labels:  tailwind, tailwindcss
react-heroicons
Heroicons as React components
Stars: ✭ 39 (-50%)
Mutual labels:  tailwind, tailwindcss
Twin.macro
🦹‍♂️ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, stitches and goober) at build time.
Stars: ✭ 5,137 (+6485.9%)
Mutual labels:  tailwind, tailwindcss
Next-JS-Landing-Page-Starter-Template
🚀 Free NextJS Landing Page Template written in Tailwind CSS 3 and TypeScript ⚡️ Made with developer experience first: Next.js 12 + TypeScript + ESLint + Prettier + Husky + Lint-Staged + VSCode + Netlify + PostCSS + Tailwind CSS
Stars: ✭ 521 (+567.95%)
Mutual labels:  tailwind, tailwindcss
tailwindcss-variables
Easily create css variables without the need for a css file!
Stars: ✭ 47 (-39.74%)
Mutual labels:  tailwind, tailwindcss
Figmatocode
Generate responsive pages and apps on HTML, Tailwind, Flutter and SwiftUI.
Stars: ✭ 2,299 (+2847.44%)
Mutual labels:  tailwind, tailwindcss
react-tailwind
This is a complementary React code for the tailwindcss project.
Stars: ✭ 29 (-62.82%)
Mutual labels:  tailwind, tailwindcss
eleventy solo starter njk
Further development suspended as of 2021-09-11. Please refer instead to https://www.11ty.dev/docs/starter/ for a wide selection of other Eleventy starter sets.
Stars: ✭ 22 (-71.79%)
Mutual labels:  tailwind, tailwindcss
EddieHubCommunity.github.io
Information about our community
Stars: ✭ 88 (+12.82%)
Mutual labels:  tailwind, tailwindcss
tailwind-ui-components
Free Tailwind CSS UI Components - Crafted for modern websites, landing pages and web apps. TailGrids Core is free and open-source so, feel free to use with your personal or commercial projects. If you would like to show your support and love, don't forget to give us a star 🌟
Stars: ✭ 49 (-37.18%)
Mutual labels:  tailwind, tailwindcss
hugo-starter-tailwind-basic
A basic and simple to set up Hugo with TailwindCSS starter project.
Stars: ✭ 80 (+2.56%)
Mutual labels:  tailwind, tailwindcss
coc-tailwind-intellisense
Coc.nvim extension for Tailwind CSS IntelliSense
Stars: ✭ 117 (+50%)
Mutual labels:  tailwind, tailwindcss
cra-tailwindcss
Integrate Tailwind CSS in a Create React App setup
Stars: ✭ 105 (+34.62%)
Mutual labels:  tailwind, tailwindcss
Goodwork
Self hosted project management and collaboration tool powered by TALL stack
Stars: ✭ 1,730 (+2117.95%)
Mutual labels:  tailwind, tailwindcss

taro-plugin-tailwind

Taro 接入 windicss / tailwindcss 插件,支持小程序 / H5,React Native 暂未测试。

1.1.x 及之后版本使用 windicss1.0.x(不再维护) 版本使用 tailwindcss,相关问题请自行查阅对应文档。

1.2.x 仅支持 Taro 3.3 及以上版本,其它版本请自行降级。

安装

在 Taro 项目根目录下安装

$ npm i taro-plugin-tailwind --save-dev
$ # 或使用 yarn
$ yarn add -D taro-plugin-tailwind

使用

引入插件

请确保 Taro CLI 已升级至 Taro 3 的最新版本,确保 taro-plugin-tailwind 版本在 v1.1.0 及以上。

修改项目 config/index.js 中的 plugins 配置如下:

const config = {
    /// ...
    plugins: [
        // ...其余插件
        'taro-plugin-tailwind',
    ],
    /// ...
    /// 亦或是传入具体参数:
    plugins: [
        // ...其余插件
        ['taro-plugin-tailwind', {
            // 具体参数见:https://github.com/windicss/vite-plugin-windicss/blob/main/packages/plugin-utils/src/options.ts#L10
        }]
    ],
};

生成配置

执行 taro tailwind --init 生成必要的配置文件:

$ taro tailwind --init // 默认生成 mini, h5 两种配置文件且必须存在
$ taro tailwind --init weapp,tt,swan // 生成其它平台以 (,) 分隔

在项目入口文件(如 main.js / app.tsx)引入 windi.css

import 'windi.css';

由此即可在项目任意位置使用 windicss,并不再需要手动引入其它文件。

参数

插件接受如下参数:

参数项 类型 是否可选 用途
config Object windicss-webpack-plugin 的可选参数(UserOption),默认值: { scan: { dirs: ['./src'], fileExtensions: ['vue', 'jsx', 'tsx'] } }

注意事项及限制

小程序

小程序不支持使用反斜杠和冒号作为类名,因此默认配置文件 mini.config.js 中,冒号、反斜杠 修改成使用下划线 _(参考 taro-tailwind

<View className="w-1/3"></View>

应该写成:

<View className="w-1_3"></View>

配置文件中 separator 也设置为 _configuration#separator)并且 preflight 选项应该始终保持关闭,不加载 modern-normalize

此外,部分小程序平台由于所支持的选择器非常有限(如微信小程序,详见 WXSS | 微信开放文档),不能使用 windicss / tailwindcss 的某些特性(如 Attributify Modespace-* 等),并非插件问题,有此类需求可考虑使用其它优秀方案:mini-program-tailwind

常见问题

Q:为什么 Intellisense 失效了?

A:根据所使用的版本选择安装 Windi CSS IntellisenseTailwind CSS Intellisense

Q:保存后新样式没有生效?

A:请暂时设置 NODE_ENVproduction 解决此问题,例:NODE_ENV=production npm run build:weapp -- --watch,具体参见示例

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].