webpack.mix.js
1.2 KB
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
const { mix } = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| 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 the application as well as bundling up all the JS files.
|
*/
// mix.setPublicPath('public');
// 设置预定义发布目录
mix.setPublicPath('public').options({
fileLoaderDirs: {
images: 'assets/dist/images',
fonts: 'assets/dist/fonts'
}
});
// 加入需要发布的资源
mix.js('public/assets/src/js/app.js', 'public/assets/dist/js')
.sass('public/assets/src/sass/app.scss', 'public/assets/dist/css');
mix.browserSync({
port: 3000,
proxy: 'example.com', // 这里修改成当前项目域名
// 这里配置监控目录,只要符合规则的文件被修改,会立即发布资源并刷新页面(只有在 npm run watch 模式下哦)
files: [
'app/**/*.php',
'public/themes/**/*.html',
'public/example/**/*.html',
'public/assets/dist/js/**/*.js',
'public/assets/dist/css/**/*.css'
]
});