-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
postcss.config.js
64 lines (60 loc) · 2.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
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
// import combineSelectors from 'postcss-combine-duplicated-selectors'
import OpenProps from 'open-props'
import combineMediaQuery from 'postcss-combine-media-query'
import postcssCustomMedia from 'postcss-custom-media'
import postcssImport from 'postcss-import'
import postcssImportExtGlob from 'postcss-import-ext-glob'
import postcssJitProps from 'postcss-jit-props'
import postcssLightningCSS from 'postcss-lightningcss'
import postcssMixins from 'postcss-mixins'
import pruneVar from 'postcss-prune-var'
import sugarss from 'sugarss'
/** @type {{ plugins: import('postcss').AcceptedPlugin[] }} */
const plugins = [
postcssImportExtGlob(),
postcssImport(),
postcssCustomMedia(),
postcssMixins(),
postcssJitProps({
...OpenProps,
// https://m3.material.io/styles/motion/easing-and-duration/tokens-specs
'--md-sys-motion-easing-emphasized-accelerate':
'cubic-bezier(0.3, 0.0, 0.8, 0.15)',
'--md-sys-motion-easing-emphasized-decelerate':
'cubic-bezier(0.05, 0.7, 0.1, 1.0)',
'--md-sys-motion-easing-standard': 'cubic-bezier(0.2, 0.0, 0, 1.0)',
'--md-sys-motion-easing-standard-accelerate': 'cubic-bezier(0.3, 0, 1, 1)',
'--md-sys-motion-easing-standard-decelerate': 'cubic-bezier(0, 0, 0, 1)',
}),
// combineSelectors(),
combineMediaQuery(),
]
/** @type {{ plugins: import('postcss').AcceptedPlugin[] }} */
export const vite = {
plugins: [
...plugins,
postcssLightningCSS({
browsers: 'defaults and supports css-cascade-layers',
lightningcssOptions: {
drafts: { nesting: true },
},
}),
],
}
/** @type {import('postcss-load-config').ConfigFn} */
export default ({ _env, file }) => ({
parser: sugarss,
plugins: [
...plugins,
// shiraha.css only
...(file.dirname.endsWith('shiraha/src') ? [pruneVar()] : []),
postcssLightningCSS({
browsers: 'defaults and supports css-nesting',
lightningcssOptions: {
drafts: { nesting: true },
minify: true,
// minify: env === 'production',
},
}),
],
})