-
Notifications
You must be signed in to change notification settings - Fork 5
/
postcss.config.cjs
58 lines (54 loc) · 1.84 KB
/
postcss.config.cjs
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
// const autoprefixer = require("autoprefixer");
// const cssnano = require('cssnano');
// const purgecss = require("@fullhuman/postcss-purgecss");
const IN_PRODUCTION = process.env.NODE_ENV === "production";
const bootstrap = "node_modules/bootstrap"
module.exports = {
plugins: [
IN_PRODUCTION &&
require("@fullhuman/postcss-purgecss")({
content: [
"index.html",
"./src/**/*.js",
// --- Import only the required components.
`${bootstrap}/js/dist/alert.js`,
// `${bootstrap}/js/dist/base-component.js`,
// `${bootstrap}/js/dist/button.js`,
// `${bootstrap}/js/dist/carousel.js`,
// `${bootstrap}/js/dist/collapse.js`,
// `${bootstrap}/js/dist/dropdown.js`,
// `${bootstrap}/js/dist/modal.js`,
// `${bootstrap}/js/dist/offcanvas.js`,
// `${bootstrap}/js/dist/popover.js`,
// `${bootstrap}/js/dist/scrollspy.js`,
// `${bootstrap}/js/dist/tab.js`,
// `${bootstrap}/js/dist/toast.js`,
// `${bootstrap}/js/dist/tooltip.js`,
],
defaultExtractor(content) {
const contentWithoutStyleBlocks = content.replace(
/<style[^]+?<\/style>/gi,
""
);
return (
contentWithoutStyleBlocks.match(
/[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g
) || []
);
},
keyframes: true, // remove unsed keyframe rules
variables: true, // remove unused variables as well
// safelist: [
// /-(leave|enter|appear)(|-(to|from|active))$/,
// /^(?!(|.*?:)cursor-move).+-move$/,
// /^router-link(|-exact)-active$/,
// /data-v-.*/,
// ],
}),
IN_PRODUCTION && require("autoprefixer"),
IN_PRODUCTION &&
require("cssnano")({
preset: ["default", { discardComments: { removeAll: true } }],
}),
],
};