webpack-contrib / purifycss-webpack

UNMAINTAINED, use https://github.com/FullHuman/purgecss-webpack-plugin
MIT License
772 stars 37 forks source link

React / Webpack app #61

Closed dmt0 closed 7 years ago

dmt0 commented 7 years ago

Hi! Trying to config this in my project, and so far no effect on css, and no output during build. Here's my webpack config:

new ExtractTextPlugin('bundle.css'),
new purifycss({
  basePath: path.join(__dirname, '../src'),
  resolveExtensions: ['.html', '.js'],
  paths: [
    '../src/**/*.js',
    'index.html',
  ],
  purifyOptions: {
    minify: true,
    info: true,
    rejected: true,
 }

Tried with just __dirname as basePath, tried without paths, still no output and my bundle.css stays the same. What am I doing wrong?

bebraw commented 7 years ago

I think you need to set resolveExtensions: ['.html']. Otherwise it will go through node_modules/react and pick up all sorts of classes from there. That effectively breaks purifying.

dmt0 commented 7 years ago

Tried that, same result.

bebraw commented 7 years ago

I would need a standalone example to say anything concrete. If you can set up a repo, that would be great.