-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.mix.js
80 lines (68 loc) · 1.92 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
let 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 your application, as well as bundling up your JS files.
|
*/
const inc = 'inc';
const partials = 'partials';
const assets = 'assets';
const dist = 'dist';
mix.setPublicPath( dist );
mix.setResourceRoot( '../' );
// BrowserSync
mix.browserSync( {
host: 'localhost',
proxy: 'https://pressbooks.test',
port: 3100,
files: [
'*.php',
`${inc}/**/*.php`,
`${partials}/**/*.php`,
`${dist}/**/*.css`,
`${dist}/**/*.js`,
],
} );
// Sass
mix.sass( `${assets}/styles/aldine.scss`, `${dist}/styles/aldine.css` );
mix.sass( `${assets}/styles/editor.scss`, `${dist}/styles/editor.css` );
// Javascript
mix.autoload( { jquery: [ '$', 'window.jQuery', 'jQuery' ] } );
mix
.js( `${assets}/scripts/aldine.js`, `${dist}/scripts` )
.js( `${assets}/scripts/call-to-action.js`, `${dist}/scripts` )
.js( `${assets}/scripts/catalog-admin.js`, `${dist}/scripts` )
.js( `${assets}/scripts/customizer.js`, `${dist}/scripts` )
.js( `${assets}/scripts/customizer-toggle.js`, `${dist}/scripts` )
.js( `${assets}/scripts/page-section.js`, `${dist}/scripts` );
// Assets
mix
.copy( `${assets}/fonts`, `${dist}/fonts`, false )
.copy( `${assets}/images`, `${dist}/images`, false );
// Options
mix.options( { processCssUrls: false } );
// Source maps when not in production.
if ( ! mix.inProduction() ) {
mix.sourceMaps();
}
// Hash and version files in production.
if ( mix.inProduction() ) {
mix.version();
}
// Add Isotope support.
mix.webpackConfig( {
resolve: {
alias: {
masonry: 'masonry-layout',
isotope: 'isotope-layout',
},
},
stats: {
children: true
}
} );