umi-plugin-tailwindcss-v2
v4.0.3
Published
[email protected] plugin for tailwindcss with future compatibility for tailwind version > 4
Readme
umi-plugin-tailwindcss-v2
This plugin is only valid for umijs 3.x,Umi4 has built-in support for Tailwindcss and is no longer needed for new projects. I have locked the tailwind version to 3.4.0 for now to prevent breaking changes. umi4 tailwind-css doc
Install
Using npm:
$ npm install umi-plugin-tailwindcss-v2 -Dor using yarn:
$ yarn add umi-plugin-tailwindcss-v2 -DSetup
tailwindCssFilePath?: string.
tailwind.css file path, can be missing。
// .umirc.ts
// eg
...
tailwindcss: {
tailwindCssFilePath?: '@/tailwind.css',
tailwindConfigFilePath?: 'tailwind-custom.config.js' // Default value: tailwindConfigFilePath || join(process.env.APP_ROOT || api.cwd, 'tailwind.config.js'),
},
...Explain
This plugin do the following things to support tailwind in umi。
Add
tailwindcssdependencies auto. For 4.x: defauts to the latest versiontailwindcss@latestFor 3.x: defauts to the compat version@tailwindcss/postcss7-compat, because of umi doesn't support postcss8 now)。You can also install the specific version of tailwindcss. If
tailwindcssexist indevDependencies, plugin will use it, otherwise plugin will use@tailwindcss/postcss7-compat。Add Tailwind to your CSS。If
tailwindCssFilePathsetting exist, plugin will import this css file automatically. If not exist, will create a temporary file, and import it.If
tailwind.config.jsnot exist attailwindConfigFilePath, it will create one。Add postcss plugin in umi。
