-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.mix.js
32 lines (25 loc) · 870 Bytes
/
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
const mix = require('laravel-mix');
require('dotenv').config();
require('laravel-mix-purgecss');
require('laravel-mix-copy-watched');
const theme = process.env.WP_THEME;
const themePath = `public/themes/${theme}/assets`;
mix.setResourceRoot('../');
mix.setPublicPath(`public/themes/${theme}/assets`);
mix.browserSync({
proxy: process.env.BROWSER_SYNC_HOST,
});
mix.js('resources/assets/scripts/app.js', 'scripts')
.sass('resources/assets/styles/app.scss', 'styles')
.purgeCss({
whitelist: require('purgecss-with-wordpress').whitelist,
whitelistPatterns: require('purgecss-with-wordpress').whitelistPatterns,
});
mix.copyWatched('resources/assets/images/**', themePath + '/images')
.copyWatched('resources/assets/fonts/**', themePath + '/fonts');
mix.autoload({
jquery: ['$', 'window.jQuery'],
});
if (mix.inProduction()) {
mix.version();
}