forked from piordev555/runeruby-casino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
50 lines (48 loc) · 1.75 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
const mix = require('laravel-mix');
const WebpackShellPlugin = require('webpack-shell-plugin'),
CompressionPlugin = require('compression-webpack-plugin'),
OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
mix.extend('addWebpackLoaders', (webpackConfig, loaderRules) => {
loaderRules.forEach((loaderRule) => webpackConfig.module.rules.push(loaderRule));
});
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.sass('resources/sass/admin/app.scss', 'public/css/admin')
.sass('resources/sass/error.scss', 'public/css')
.copy('resources/img', 'public/img')
.copy('resources/webfonts', 'public/webfonts')
.copy('resources/sounds', 'public/sounds')
.options({
processCssUrls: false
})
.version()
.webpackConfig({
plugins: [
new WebpackShellPlugin({
onBuildStart: ['php artisan cache:clear --quiet'],
onBuildEnd: []
}),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.optimize\.css$/g,
cssProcessor: require('cssnano'),
cssProcessorPluginOptions: {
preset: ['default', { discardComments: { removeAll: true } }],
},
canPrint: true
}),
new CompressionPlugin({
filename: '[path].gz[query]',
algorithm: 'gzip',
test: /\.js$|\.css$|\.html$|\.eot?.+$|\.ttf?.+$|\.woff?.+$|\.svg?.+$/,
threshold: 10240,
minRatio: 0.8,
cache: false
})
]
})
.addWebpackLoaders([
{
test: /\.key|\.txt$/i,
use: "raw-loader"
}
]);