-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
64 lines (61 loc) · 1.55 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
let mix = require("laravel-mix");
require("laravel-mix-purgecss");
require("dotenv").config();
const path = require("path");
let purgecssWordpress = require("purgecss-with-wordpress");
mix.webpackConfig({
watchOptions: { ignored: /node_modules/ },
externals: { jquery: "jQuery" },
});
mix.setPublicPath('./' + process.env.MIX_PURGECSS_THEME_PATH)
.sass("assets/scss/theme.scss", "assets/css/theme.css")
.sass("assets/scss/editor.scss", "assets/css/editor.css")
.purgeCss({
enabled: false,
extend: {
content: [
path.join(
__dirname,
path.join(process.env.MIX_PURGECSS_THEME_PATH, "/**/*.php")
),
"assets/js/**/*.js",
path.join(
__dirname,
path.join(
process.env.MIX_PURGECSS_THEME_PATH,
"acf-json/**/*.json"
)
),
"src/wp-content/plugins/**/*.php",
"src/wp-content/plugins/**/*.js",
"src/wp-includes/js/dist/**/*.js",
],
safelist: [
...purgecssWordpress.safelist,
/g-,*/,
/gform.*/,
/bg-.*/,
/swiper-.*/,
/slider-.*/,
/#*/,
],
},
})
.js("assets/js/theme.js", "assets/js/theme.js")
.js("assets/js/editor.js", "assets/js/editor.js")
.version()
.sourceMaps()
.options({ processCssUrls: false });
if (process.env.MIX_BROWSERSYNC == "true") {
mix.browserSync({
proxy: "https://" + process.env.MIX_DOMAIN,
host: process.env.MIX_DOMAIN,
notify: false,
files: ["./src/**/*"],
open: "external",
https: {
key: process.env.MIX_CERT_PATH + process.env.MIX_DOMAIN + ".key",
cert: process.env.MIX_CERT_PATH + process.env.MIX_DOMAIN + ".crt",
},
});
}