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')
|
||||
const glob = require('glob-all')
|
||||
const PurgecssPlugin = require('purgecss-webpack-plugin')
|
||||
let Encore = require('@symfony/webpack-encore')
|
||||
let PurgecssConfig = require('./purgecss.config')
|
||||
let PurgecssPlugin = require('purgecss-webpack-plugin')
|
||||
|
||||
Encore
|
||||
.disableSingleRuntimeChunk()
|
||||
|
@ -13,13 +13,7 @@ Encore
|
|||
.enableSourceMaps(!Encore.isProduction())
|
||||
|
||||
if (Encore.isProduction()) {
|
||||
Encore.addPlugin(new PurgecssPlugin({
|
||||
defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
|
||||
paths: () => glob.sync([
|
||||
'assets/**/*.vue',
|
||||
'source/**/*.{md,twig}'
|
||||
])
|
||||
}))
|
||||
Encore.addPlugin(new PurgecssPlugin(PurgecssConfig))
|
||||
}
|
||||
|
||||
module.exports = Encore.getWebpackConfig()
|
||||
|
|
Reference in a new issue