Skip to content

Commit

Permalink
example(with-tailwindcss): Removed postcss rule in plugin webpack cha…
Browse files Browse the repository at this point in the history
…in (umijs#280)

* example: Added with-tailwindcss example

* example(with-tailwindcss): Removed postcss rule in webpack chain

* example(with-tailwindcss): Removed unused dependencies
  • Loading branch information
yuaanlin committed Jan 19, 2022
1 parent 30716c5 commit 4140752
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
2 changes: 0 additions & 2 deletions examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"start": "npm run dev"
},
"dependencies": {
"postcss-loader": "6.2.1",
"style-loader": "^3.3.1",
"tailwindcss": "^3.0.15",
"umi": "4.0.0-beta.16"
}
Expand Down
17 changes: 0 additions & 17 deletions examples/with-tailwindcss/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@ import path from 'path';
import { IApi } from 'umi';

export default (api: IApi) => {
/** 在 Webpack-chain 中加入 postcss 的规则,用于处理 tailwindcss 的样式 */
api.chainWebpack((memo) => {
memo.module
.rule('tailwind')
.test(/\.tacss$/)
.use('style')
.loader('style-loader')
.end()
.use('css')
.loader('css-loader')
.end()
.use('postcss')
.loader('postcss-loader')
.end();
return memo;
});

/** 由于修改 .tsx 文件不会触发 css 文件的重新编译,
* 在 onCheckCode 时对 tailwind.css 文件进行 touch,手动触发 JIT 重新编译 */
api.onCheckCode(() => {
Expand Down

0 comments on commit 4140752

Please sign in to comment.