-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
47 lines (41 loc) · 1.06 KB
/
webpack.mix.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
//========== Laravel Mix ==========//
const mix = require('laravel-mix');
const path = require('path');
require('laravel-mix-purgecss');
// Run Mix
mix
// cleaner aliases for js module imports (optional)
.webpackConfig({
resolve: {
alias: {
'@utilities': path.resolve(__dirname, 'resources/js/utilities'),
'@modules': path.resolve(__dirname, 'resources/js/modules'),
},
},
})
// Compile Javascript
.js('resources/js/main.js', 'js/')
// Compile SCSS
.sass('resources/sass/main.scss', 'css/')
.options({ processCssUrls: false });
// Production only
if (mix.inProduction()) {
// Purge our CSS
// mix minifies CSS & JS by default
// I prefer to add the `.min` suffix on the output files just for convention
mix
.purgeCss({
content: ['site/**/*.njk'],
safelist: [
'menu-visible',
'loaded',
'expanded',
/^type-/,
/^page-/,
/[data-src]/,
],
extractorPattern: [/[^<>"'`\s]*[^<>"'`\s:]/g],
})
.minify('css/main.css')
.minify('js/main.js');
}