0

我添加了清除,在构建后仍然发布 css,它正在抓取整个文件,而不仅仅是我使用过的库。

包.json

"scripts": {
"start" : "npm-run-all start:tailwind -l -p start:p:*",
"start:tailwind": "postcss ./src/assests/css/tailwind.src.css -o ./src/assests/css/tailwind.css",
"start:p:watch-tailwind": "onchange 'tailwind.config.js' 'src/**/*.css' -e './src/assests/css/tailwind.css' -- npm run start:tailwind",
"start:p:react": "react-scripts start",
"build": "run-s build:** -l",
"build:a:tailwind": "SET NODE_ENV=production && npm run start:tailwind",
"build:b:react": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"

},

tailwind.config.js

const colors = require('tailwindcss/colors');
module.exports = {
  purge: {
    mode:'layers',
    content:['src/**/*.js','src/**/*.jsx','src/**/*.ts','src/**/*.tsx','public/**/*.html'],
  },
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {
      colors:{
        blue:colors.lightBlue,
        gray:colors.trueGray,
        red: colors.yellow,
      }
    },
  },
  variants: {
    extend: {},
  },
  plugins: [],
}

postcss.config.js

module.exports = {
  plugins: [
    require('tailwindcss'),
    require('postcss-nested'),
    require('autoprefixer'),
  ]
}
4

0 回答 0