-
Notifications
You must be signed in to change notification settings - Fork 0
/
postcss.config.js
64 lines (63 loc) · 1.91 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
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
const path = require("path")
module.exports = ({env}) => ({
"map": (env !== "production") ? true : false,
"plugins": {
"postcss-import": {
"path": [
`${process.env.npm_package_config_paths_src}/css`
]
},
"postcss-apply": true,
"postcss-preset-env": {
"stage": 2,
"features": {
"custom-media-queries": true,
"color-mod-function": {
"unresolved": "error"
},
"custom-properties": {
"preserve": false
},
"custom-selectors": true,
"nesting-rules": true,
}
},
"postcss-url": [
{
filter: "**/node_modules/**", // node_module assets
url: "inline",
ignoreFragmentWarning: true,
maxSize: 1, // KB
fallback: "copy",
assetsPath: path.resolve(process.cwd(), `${process.env.npm_package_config_paths_dest}/vendor`),
useHash: true,
hashOptions: {
append: true
},
},
{
filter: `**/${process.env.npm_package_config_paths_src}/**`, // catch everything else from project.
url: "inline",
maxSize: 1, // KB
fallback: "copy",
assetsPath: path.resolve(process.cwd(), `${process.env.npm_package_config_paths_dest}/local`),
useHash: true,
hashOptions: {
append: true
},
basePath: path.resolve(process.cwd(), `${process.env.npm_package_config_paths_src}`)
},
],
"cssnano": (env === "production") ? {
"safe": true,
"autoprefixer": false // handled by postcss-preset-env
} : false,
"postcss-browser-reporter": (env !== "production") ? true : false,
"postcss-reporter": (env !== "production") ? true : false,
"postcss-hash": (env === "production") ? {
algorithm: "sha256",
trim: 8,
manifest: path.resolve(process.cwd(), `${process.env.npm_package_config_paths_dest}/manifest.json`)
} : false
}
})