purifycss-webpack icon indicating copy to clipboard operation
purifycss-webpack copied to clipboard

Support for React (typescript) with inline CSS, is this possible?

Open sandrocsimas opened this issue 6 years ago • 1 comments

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?

sandrocsimas avatar May 09 '18 14:05 sandrocsimas

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".

sandrocsimas avatar May 09 '18 14:05 sandrocsimas