Closed elvisbegovic closed 7 years ago
Had same issue, but, I thing i fixed it by adding
resolveExtensions: ['.html']
before my config was
new Purify({
basePath: __dirname,
paths: [
'/home/*.html'
],
//resolveExtensions: ['.html'],
purifyOptions: {
minify: true,
rejected: true
}
})
without 'resolveExtensions', plugin takes all from webpack's 'resolve.extensions' and if log the files variable inside plugin it would be like
[ */home/index.html',
'*/node_modules/css-loader/lib/css-base.js',
'*/node_modules/style-loader/addStyles.js',
'*/source/home/index.js',
'*source/home/style.css' ]
so source css file in files that be passed to purify, and it thinks styles is used and doesn't remove them if add 'resolveExtensions: ['.html']' path variable would be like
[ '*/home/index.html' ]
Just the right html will be passed to purify. Hope this will help fix your issue. P.S. Maybe I'm wrong in explaining, but its works.
@HumbleBeck Wow man, thanks. It is absolutely necessary to add resolveExtensions: ['.html']
to the Purify-Webpack-Plugin object, otherwise it thinks all css is used and does nothing. Works like a charm, now!
Shouldn't this be stated in the docs? I had the same issue. Thanks for the solution!
Same. Please add it to the docs, or even better, set it as a default and document how to change it.
Hi,
I use loader
extractCSS.extract([ 'css', 'sass' ])
And in my plugins I add
When I build my app without purifycss plugin my css i builded and minified but when I put purifycss plugin as above, so my css is well extracted to an build.css file but two problem : it isn't minified and the big problem is my unused class are still here, no change effect!
thanks in advance