-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.mix.js
65 lines (63 loc) · 1.68 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
const mix = require("laravel-mix");
require("laravel-mix-purgecss");
require("laravel-mix-jigsaw");
const { GenerateSW } = require("workbox-webpack-plugin");
const categoryGenerator = require("./tasks/generateCategories.js");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const ImageBuildPlugin = require("./tasks/ImageBuildPlugin");
mix.disableSuccessNotifications();
mix.setPublicPath("source/assets/build/");
mix.options({
production: process.env.WEBPACK_ENV === "production"
})
mix.webpackConfig({
plugins: [
new ImageBuildPlugin({
inject: false,
}),
categoryGenerator,
new CopyWebpackPlugin({
patterns: [{ from: "source/assets/build/images", to: "images" }],
}),
new GenerateSW({
// these options encourage the ServiceWorkers to get in there fast
// and not allow any straggling "old" SWs to hang around
clientsClaim: true,
skipWaiting: true,
swDest: "../../service-worker.js", //Need to move the service-worker to the root
}),
],
});
mix
.js("source/_assets/js/main.js", "js")
.vue()
.sass("source/_assets/sass/main.scss", "css/main.css")
.jigsaw({
watch: [
"config.php",
"source/**/*.md",
"source/**/*.php",
"source/**/*.scss",
],
})
.options({
processCssUrls: false,
postCss: [
require("tailwindcss"),
// require('postcss-css-variables')({
// preserve: true
// })
],
})
.purgeCss({
content: [
"source/**/*.html",
"source/**/*.md",
"source/**/*.js",
"source/**/*.php",
"source/**/*.vue",
],
safelist: { deep: [/language/, /hljs/, /mce/, /^hljs-.*/] },
})
.sourceMaps()
.version();