-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.mix.js
81 lines (74 loc) · 1.85 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
"use strict";
const mix = require("laravel-mix");
const tailwindcss = require("tailwindcss");
const glob = require("glob-all");
// const PurgecssPlugin = require("purgecss-webpack-plugin");
const colorFunction = require("postcss-color-function");
const autoprefixer = require("autoprefixer");
const momentumScrolling = require("postcss-momentum-scrolling");
const PATHS = {
src : path.join(__dirname, "src"),
public : path.join(__dirname, "public")
};
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
class TailwindExtractor {
static extract(content) {
return content.match(/[A-z0-9-:\/]+/g);
}
}
mix.webpackConfig({
node: {
fs: "empty",
tls: "empty",
net: "empty"
}
});
mix
.react("src/client/index.jsx", "public/static/js/bundle.js")
.sass("src/assets/scss/tailwind.scss", "public/static/stylesheets/bundle.css")
.options({
postCss: [
tailwindcss("tailwind.js"),
colorFunction(),
autoprefixer(),
momentumScrolling([
"hidden",
"scroll",
"auto",
"inherit"
])
],
processCssUrls: false
})
.browserSync({
proxy: "localhost:3000",
port: 8080,
ghostMode: false,
files: [
"public/static/js/bundle.js",
"public/static/stylesheets/bundle.css"
]
});
// mix.sass("node_modules/aos/src/sass/aos.scss", "public/css/aos.css");
// mix.webpackConfig({
// plugins: [
// new PurgecssPlugin({
// paths: glob.sync([
// `${PATHS.src}/**/*.jsx`,
// `${PATHS.src}/**/*.js`,
// `${PATHS.src}/**/*.ejs`,
// ], { nodir: true }),
// whitelistPatterns: [/^aos/],
// extractors: [
// {
// extractor: TailwindExtractor,
// extensions: ["js", "jsx", "ejs"]
// }
// ]
// })
// ]
// });