purifycss-webpack
purifycss-webpack copied to clipboard
Support for React (typescript) with inline CSS, is this possible?
I have a React project (typescript) that bundles to a single JS file including everything. PurifyCSS webpack plugin is not working as expected. The following is the relevant code of my Webpack config:
{
test: /\.less$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
minimize: env === 'production',
},
},
'less-loader',
],
include: helpers.root('/src/assets/styles'),
}
new PurifyCSSPlugin({
paths: glob.sync(`${helpers.root('/src')}/**/*`),
styleExtensions: ['.js', '.css', '.less'],
moduleExtensions: ['.js'],
verbose: true,
})
This project doesn't have HTML files, only Typescript and Less files. How to use PurifyCSS in this case? This only works using ExtractTextPlugin?
It seems the plugin only read the output files. Is there a way to use it as a loader? The purifycss should be applied after "css-loader" of "style-loader".