パージを追加しました。ビルド後も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'),
]
}