【问题标题】:PostCSS not purgingPostCSS 不清除
【发布时间】:2021-10-16 20:47:14
【问题描述】:

我在 Windows 10 上使用 Node v14.15.4 和 npm 6.14.10

我已经成功执行了下面的命令

npm install -D tailwindcss@latest postcss@latest autoprefixer@latest postcss-cli cssnano onchange

这没有效果:

"tw:prod": "SET NODE_ENV=production postcss build ./src/css/tailwind.css -o ./public/css/tailwind.css",

如果我删除 SET NODE_ENV=production 它可以工作,但 public/css/tailwind.css 仍然是 3.2MB。

"tw:prod": "postcss build ./src/css/tailwind.css -o ./public/css/tailwind.css",

为什么不清除?

【问题讨论】:

    标签: tailwind-css postcss


    【解决方案1】:

    您可能必须创建一个configuration file 并在the purge option 中提供模板的路径。

    npx tailwindcss init
    
    // tailwind.config.js
    module.exports = {
      purge: [
        './src/**/*.html',
        './src/**/*.vue',
        './src/**/*.jsx',
      ],
      theme: {},
      variants: {},
      plugins: [],
    }
    

    【讨论】:

    • 这一切都完成了。 windows命令有问题,SET NODE_ENV=production & postcss build ...
    猜你喜欢
    • 2021-04-03
    • 2021-04-17
    • 2021-07-22
    • 2017-09-07
    • 2017-02-26
    • 1970-01-01
    • 2021-05-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多