@@ -15,6 +15,16 @@ const ManifestPlugin = require('webpack-manifest-plugin')
15
15
const PurgecssPlugin = require ( 'purgecss-webpack-plugin' )
16
16
const glob = require ( 'glob-all' )
17
17
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
+
18
28
const env = require ( '../config/prod.env' )
19
29
20
30
const webpackConfig = merge ( baseWebpackConfig , {
@@ -63,7 +73,16 @@ const webpackConfig = merge(baseWebpackConfig, {
63
73
path . join ( __dirname , './../templates/**/*.twig' ) ,
64
74
path . join ( __dirname , './../**/*.vue' ) ,
65
75
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
+ ]
67
86
} ) ,
68
87
// Compress extracted CSS. We are using this plugin so that possible
69
88
// duplicated CSS from different components can be deduped.
0 commit comments