-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
58 lines (50 loc) · 1.69 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const Encore = require('@symfony/webpack-encore');
const PurgeCssPlugin = require('purgecss-webpack-plugin');
// const {InjectManifest, GenerateSW} = require('workbox-webpack-plugin');
const path = require('path');
const glob = require('glob-all');
const _ = require('lodash');
const isProduction = Encore.isProduction();
Encore
.setOutputPath('public/tailwind-theme')
.setPublicPath('/tailwind-theme')
.addEntry('app', './themes/TailwindTheme/assets/app.js')
.disableSingleRuntimeChunk()
.cleanupOutputBeforeBuild()
.enableSassLoader(function (options) {}, {
resolveUrlLoader: false
})
.enableSourceMaps(!isProduction)
.enableVersioning(isProduction)
.enableBuildNotifications(!isProduction)
.enablePostCssLoader()
;
if(isProduction) {
Encore.addPlugin(new PurgeCssPlugin({
paths: glob.sync([
path.join(__dirname, '../../themes/**/views/**/*.html.twig'),
path.join(__dirname, '../../themes/**/assets/**/*.js'),
path.join(__dirname, '../../vendor/**/Resources/**/*.html.twig'),
path.join(__dirname, '../../templates/**/Resources/**/*.html.twig')
]),
extractors: [
{
extractor: class {
static extract(content) {
return content.match(/[A-z0-9-_:\/]+/g) || []
}
},
extensions: [
'twig',
'js',
'vue',
],
whitelistPatterns: [
]
}
]
}));
}
const config = Encore.getWebpackConfig();
config.name = 'tailwindTheme';
module.exports = config;