-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.mix.js
61 lines (59 loc) · 1.56 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
58
59
60
61
const mix = require('laravel-mix')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin')
require('laravel-mix-copy-watched')
require('laravel-mix-nunjucks')
mix
.setPublicPath('dist/')
.js('src/js/app.js', 'js')
.sass('src/css/app.scss', 'css')
.njk('src/templates/', 'dist/')
.browserSync({
server: 'dist/',
files: [
//'src/css/**/*.{css,scss}',
//'src/js/**/*.js',
'src/fonts/**/*.{woff,woff2}',
'src/img/**/*.{ico,gif,jpg,png,svg}',
'src/templates/**/*.html',
'dist/css/*.css',
//'tailwind.config.js',
],
})
.copyWatched('src/fonts/**/*.{woff,woff2}', 'dist/fonts')
.webpackConfig({
plugins: [
new CleanWebpackPlugin(),
new CopyPlugin({
patterns: [
{
from: '**/*.{ico,gif,jpg,png,svg}',
to: 'img',
context: 'src/img',
},
],
}),
new ImageMinimizerPlugin({
minimizer: {
implementation: ImageMinimizerPlugin.imageminMinify,
options: {
plugins: [
['gifsicle'],
['mozjpeg', { quality: 50 }],
['pngquant', { quality: [0.5, 0.5] }],
['svgo'],
],
},
},
}),
],
})
.options({
processCssUrls: false,
terser: { extractComments: false } // Stop Mix from generating license file
})
.disableSuccessNotifications()
if (mix.inProduction()) {
mix.version()
}