跳到主要内容

Tailwindcss 2.x

目前,有些用户由于现有的项目,已经是 webpack 4, postcss 7.x 且无法往上升级,但是又想要使用 tailwindcss,

所以写了这个文档作为参考,在现有版本的情况下,不推荐任何的新项目使用

安装

在这种条件下,只能使用 tailwindcss 2.x 版本。

参考 https://v2.tailwindcss.com/docs/installation#post-css-7-compatibility-build 中的安装方式

安装好之后,一定要打开 jit 模式, https://github.com/icebreaker-trash/uni-app-vue2-tailwind-hbuilder-template/blob/master/tailwind.config.js

具体更多的细节,详见下方模板代码。

vue2 hbuilderx 参考模板

注意,一定要在开发环境中设置

process.env.TAILWIND_MODE = "watch"

才能正常热更新

https://github.com/icebreaker-trash/uni-app-vue2-tailwind-hbuilder-template