-
Notifications
You must be signed in to change notification settings - Fork 0
/
postcss.config.js
38 lines (33 loc) · 1.01 KB
/
postcss.config.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
const postcssPseudoEnter = require("postcss-pseudo-class-enter");
const postcssInset = require("postcss-inset");
const postcssNesting = require("postcss-nesting");
const postCssCustomMedia = require("postcss-custom-media");
const postcssCustomProperties = require("postcss-custom-properties");
const cssnano = require("cssnano");
const atImport = require("postcss-import");
const { customMedia, customProperties } = require("./src/ui/theme.js");
/**
* @param {boolean} isProd
* @returns {Transformer[]}
*/
function getPlugins(isProd) {
const plugins = [
atImport({ root: "src/ui/global.css" }),
postcssNesting(),
postCssCustomMedia({ importFrom: { customMedia } }),
postcssCustomProperties({
importFrom: { customProperties },
preserve: true,
exportTo: "./public/build/props.css",
}),
postcssInset(),
postcssPseudoEnter(),
];
if (isProd) {
return plugins.concat([cssnano({ preset: "advanced" })]);
}
return plugins;
}
module.exports = {
plugins: getPlugins(process.env.NODE_ENV === "production"),
};