forked from spatie/freek.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
57 lines (49 loc) · 1.76 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
48
49
50
51
52
53
54
55
56
57
const glob = require('glob-all');
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
const purgeCss = require('purgecss-webpack-plugin');
mix
.js('resources/assets/js/front/front.js', 'public/js')
.js('resources/assets/js/back/back.js', 'public/js')
.sass('resources/assets/css/front/front.scss', 'public/css')
.sass('resources/assets/css/back/back.scss', 'public/css')
.options({
processCssUrls: false,
postCss: [
tailwindcss('tailwind.js'),
],
})
.version()
.webpackConfig({
output: {
chunkFilename: 'js/[name].js',
},
resolve: {
alias: {
'vue$': 'vue',
},
},
plugins: [
new purgeCss({
paths: glob.sync([
path.join(__dirname, 'app/**/*.php'),
path.join(__dirname, 'resources/views/**/*.blade.php'),
path.join(__dirname, 'resources/assets/js/**/*.vue'),
path.join(__dirname, 'node_modules/simplemde/**/*.js'),
path.join(__dirname, 'node_modules/turbolinks/**/*.js'),
path.join(__dirname, 'vendor/spatie/menu/**/*.php'),
]),
whitelistPatterns: [/carbon/, /language/, /hljs/, /cm-/, /alert-/],
extractors: [
{
extractor: class {
static extract(content) {
return content.match(/[A-z0-9-:\/]+/g)
}
},
extensions: ['html', 'js', 'php', 'vue'],
}
]
})
],
});