Purge unused css in jsx files #3926
-
Hello, I'm new in module.exports = {
purge: {
enabled: true,
content: [
'./src/scripts/**/*.jsx',
],
options: {
keyframes: true,
},
},
darkMode: 'class',
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
@tailwind base;
@tailwind components;
@tailwind utilities;
body {
font-family: 'Nunito', sans-serif;
}
@layer components {
.btn {
@apply px-5 py-3 rounded;
}
.btn-blue {
@apply bg-blue-500 hover:bg-blue-600 text-white;
}
}
import '../styles/index.css';
import { h, render } from 'preact';
function App() {
return (
<div className="container">
<h1 className="text-center text-4xl text-red-500">Hello</h1>
<button type="button" className="btn btn-blue">hover me</button>
</div>
);
}
render(<App />, document.body);
...
module: {
rules: [{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: {
tailwindcss: { config: resolve('tailwind.config.js') },
autoprefixer: {},
}
}
}
}
],
},
"webpack": "4.44.1",
"postcss": "^8.2.9",
"postcss-loader": "4",
"tailwindcss": "^2.0.4",
"autoprefixer": "^10.2.5",
"css-loader": "^3.0.0", Sorry for my poor English, any help will be appreciate |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey! Are you able to share your project repo? Are you sure that the |
Beta Was this translation helpful? Give feedback.
Hey!
Are you able to share your project repo? Are you sure that the
.src/scripts/**/*.jsx
path is correct? What does your PostCSS config file look like?