-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathwebpack.mix.js
64 lines (50 loc) · 1.47 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
const mix = require('laravel-mix');
require('laravel-mix-purgecss');
// Public path helper
const publicPath = path => `${mix.config.publicPath}/${path}`;
// Source path helper
const src = path => `resources/assets/${path}`;
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Sage application. By default, we are compiling the Sass file
| for your application, as well as bundling up your JS files.
|
*/
// Public Path
mix
.setPublicPath('./dist')
.setResourceRoot(`/app/themes/sage/${mix.config.publicPath}/`)
.webpackConfig({
output: {publicPath: mix.config.resourceRoot}
});
// Browsersync
mix.browserSync('tech-bits.website');
// Styles
mix.sass(src`styles/app.scss`, 'styles');
// JavaScript
mix.js(src`scripts/app.js`, 'scripts')
.js(src`scripts/customizer.js`, 'scripts')
.extract();
// Assets
mix.copyDirectory(src`images`, publicPath`images`)
.copyDirectory(src`fonts`, publicPath`fonts`);
// Autoload
mix.autoload({
jquery: ['$', 'window.jQuery'],
});
// Options
mix.options({
processCssUrls: false,
postCss: [require('tailwindcss')('./tailwind.config.js')],
});
mix.purgeCss();
// Source maps when not in production.
mix.sourceMaps(false, 'source-map');
// Hash and version files in production.
if (mix.inProduction()) {
mix.version();
}