-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.mix.js
60 lines (56 loc) · 1.74 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
let mix = require("laravel-mix");
require("mix-html-builder");
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for your application, as well as bundling up your JS files.
|
*/
mix.setPublicPath("dist")
.html({
htmlRoot: "src/views/**/*.html",
output: "../dist",
partialRoot: "src/views/partials",
layoutRoot: "src/views/layouts",
inject: true,
versioning: true,
minify: {
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: true,
conservativeCollapse: true,
},
})
.js("src/js/app.js", "dist/js")
.sass("src/sass/app.scss", "dist/css")
.options({
postCss: [require("autoprefixer"), require("cssnano")],
processCssUrls: true,
})
.browserSync({
proxy: "127.0.0.1:8000",
files: ["dist/**/*.html", "dist/css/*.css", "dist/js/*.js"],
open: true,
notify: false,
})
.version();
mix.extend("addWebpackLoaders", (webpackConfig, loaderRules) => {
loaderRules.forEach(loaderRule => {
webpackConfig.module.rules.push(loaderRule);
});
});
mix.addWebpackLoaders([
{
test: /\.scss$/,
loader: "import-glob-loader",
},
]);