@@ -15,6 +15,16 @@ const ManifestPlugin = require('webpack-manifest-plugin')
1515const PurgecssPlugin = require ( 'purgecss-webpack-plugin' )
1616const glob = require ( 'glob-all' )
1717
18+ // Custom PurgeCSS extractor for Tailwind that allows special characters in
19+ // class names.
20+ //
21+ // https://github.com/FullHuman/purgecss#extractor
22+ class TailwindExtractor {
23+ static extract ( content ) {
24+ return content . match ( / [ A - z 0 - 9 -:\/ ] + / g) || [ ] ;
25+ }
26+ }
27+
1828const env = require ( '../config/prod.env' )
1929
2030const webpackConfig = merge ( baseWebpackConfig , {
@@ -63,7 +73,16 @@ const webpackConfig = merge(baseWebpackConfig, {
6373 path . join ( __dirname , './../templates/**/*.twig' ) ,
6474 path . join ( __dirname , './../**/*.vue' ) ,
6575 path . join ( __dirname , './../src/**/*.js' )
66- ] )
76+ ] ) ,
77+ extractors : [
78+ {
79+ extractor : TailwindExtractor ,
80+
81+ // Specify the file extensions to include when scanning for
82+ // class names.
83+ extensions : [ "html" , "js" , "twig" , "vue" ]
84+ }
85+ ]
6786 } ) ,
6887 // Compress extracted CSS. We are using this plugin so that possible
6988 // duplicated CSS from different components can be deduped.
0 commit comments