This repository has been archived by the owner on Mar 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.mix.js
51 lines (45 loc) · 1.68 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
require('dotenv').config();
let mix = require('laravel-mix');
const proxy_url = process.env.MIX_URL_PROXY;
const config = require('./config.json');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your WP theme. By default, we are compiling the Sass
| file for your application, as well as bundling up your JS files.
|
*/
mix.setPublicPath(config.paths.build);
mix.setResourceRoot(config.paths.root);
mix.js(`${config.paths.assets}/${config.scripts}`, `${config.paths.build}/scripts/`)
.extract(config.extract)
.sass(`${config.paths.assets}/${config.sass}`, `${config.paths.build}/styles/`)
.copy(`${config.paths.assets}/images/**/*.{png,jpg,jpeg,gif,svg,ico}`, `${config.paths.build}/images`, false)
.copy(`${config.paths.assets}/fonts/**/*.{eot,svg,ttf,otf,woff,woff2}`, `${config.paths.build}/fonts`, false);
mix.options({
// processCssUrls: false,
vue: {
esModule: true
},
// extractVueStyles: `${config.paths.build}/${config.vue_css}` // Path or boolean
// globalVueStyles: file, // Variables file to be imported in every component.
});
if (mix.inProduction()) {
// Hash and version files in production.
mix.version(); // need to add cb to theme's php page
}
else {
mix.webpackConfig({
devtool: 'inline-source-map',
});
// Source maps when not in production.
mix.sourceMaps()
// .browserSync(config.serve);
.browserSync({
proxy: proxy_url,
files: config.serve.files
});
}