Split PurgeCSS configuration
This commit is contained in:
parent
0095f72d61
commit
595b9f74e6
9
purgecss.config.js
Normal file
9
purgecss.config.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
let glob = require('glob-all')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
|
||||||
|
paths: () => glob.sync([
|
||||||
|
'assets/**/*.vue',
|
||||||
|
'source/**/*.{md,twig}'
|
||||||
|
])
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
const Encore = require('@symfony/webpack-encore')
|
let Encore = require('@symfony/webpack-encore')
|
||||||
const glob = require('glob-all')
|
let PurgecssConfig = require('./purgecss.config')
|
||||||
const PurgecssPlugin = require('purgecss-webpack-plugin')
|
let PurgecssPlugin = require('purgecss-webpack-plugin')
|
||||||
|
|
||||||
Encore
|
Encore
|
||||||
.disableSingleRuntimeChunk()
|
.disableSingleRuntimeChunk()
|
||||||
|
@ -13,13 +13,7 @@ Encore
|
||||||
.enableSourceMaps(!Encore.isProduction())
|
.enableSourceMaps(!Encore.isProduction())
|
||||||
|
|
||||||
if (Encore.isProduction()) {
|
if (Encore.isProduction()) {
|
||||||
Encore.addPlugin(new PurgecssPlugin({
|
Encore.addPlugin(new PurgecssPlugin(PurgecssConfig))
|
||||||
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
|
|
||||||
paths: () => glob.sync([
|
|
||||||
'assets/**/*.vue',
|
|
||||||
'source/**/*.{md,twig}'
|
|
||||||
])
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Encore.getWebpackConfig()
|
module.exports = Encore.getWebpackConfig()
|
||||||
|
|
Loading…
Reference in a new issue