This repository was archived by the owner on Feb 1, 2020. It is now read-only.
This repository was archived by the owner on Feb 1, 2020. It is now read-only.
Doesn't detect classes inside es6 template strings #32
Closed
Description
- webpack 4
- purgecss-webpack-plugin 1.2.0
this doesn't work (below 2 classes don't appear in the final css bundle):
const className = `no-underline bg-blue-lighter`
this works (single quote):
const className = 'no-underline bg-blue-lighter'
My config:
const path = require('path');
const glob = require('glob');
const PurgecssPlugin = require('purgecss-webpack-plugin');
class TailwindExtractor {
static extract(content) {
return content.match(/[A-z0-9-:/]+/g) || [];
}
}
new PurgecssPlugin({
// files to scan for class names.
paths: glob.sync(path.join(__dirname, './src/**/*.js')),
extractors: [
{
extractor: TailwindExtractor,
extensions: ['js', 'jsx'],
},
],
whitelist: ['html', 'body'],
whitelistPatterns: [],
});
Metadata
Metadata
Assignees
Labels
No labels