forked from joshuaiz/air
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.mix.js
109 lines (104 loc) · 2.8 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// eslint-disable
const mix = require("laravel-mix");
const BrowserSyncPlugin = require("browser-sync-webpack-plugin");
/**
* Development Builds
*
* The below runs using either `npm run dev` or `npm run watch`
* when you're developing locally. Will refresh the browser too.
*
*/
mix
.postCss("library/css/theme-style.css", "library/css/style.css")
.options({
from: "undefined",
postCss: [
require("postcss-import"),
require("tailwindcss"),
require("postcss-nested"),
require("autoprefixer")
],
processCssUrls: false,
uglify: {
parallel: 8, // Use multithreading for the processing
uglifyOptions: {
mangle: true,
compress: false // The slow bit
}
}
})
.webpackConfig({
plugins: [
new BrowserSyncPlugin({
files: "**/*.php",
proxy: "https://platetw.local",
browser: "google chrome",
https: true,
open: false
})
]
});
/**
* Extra Builds
*
* Uncomment these to build editor styles for Classic + Gutenberg editors.
* These add to the build time so only run when you need them.
*/
// .postCss(
// "library/css/editor/editor-styles.css",
// "library/css/editor/editor-style.css"
// )
// .options({
// postCss: [
// require("postcss-import"),
// require("tailwindcss"),
// require("postcss-nested"),
// require("autoprefixer")
// ]
// })
// .postCss(
// "library/css/editor/gutenberg-styles.css",
// "library/css/editor/gutenberg.css"
// )
// .options({
// postCss: [
// require("postcss-import"),
// require("tailwindcss"),
// require("postcss-nested"),
// require("autoprefixer")
// ]
// })
// .postCss(
// "library/css/editor/block-editor-styles.css",
// "library/css/editor/block-editor.css"
// )
// .options({
// postCss: [
// require("postcss-import"),
// require("tailwindcss"),
// require("postcss-nested"),
// require("autoprefixer")
// ]
// });
/**
* Production Build
*
* Run `npm run prod` to create a minified production build.
*
* This will also run PurgeCSS removing all of the Tailwind
* stuffs you didn't use. Really cool.
*/
if (mix.inProduction()) {
mix.options({
postCss: [
require("postcss-import"),
require("tailwindcss"),
require("postcss-nested"),
require("autoprefixer"),
require("@fullhuman/postcss-purgecss")({
content: ["./**.php", "./**/**.php", "./**.html", "./**.js"],
defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || []
})
]
});
}