forked from openai/apps-sdk-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostcss.config.mjs
More file actions
52 lines (46 loc) · 1.39 KB
/
postcss.config.mjs
File metadata and controls
52 lines (46 loc) · 1.39 KB
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
import tailwindcss from "@tailwindcss/postcss"
import autoprefixer from "autoprefixer"
import postcssNested from "postcss-nested"
import platformUIFunctions from "./postcss/functions.mjs"
import injectBreakpoints from "./postcss/injectBreakpoints.mjs"
import platformUIMixins from "./postcss/mixins.mjs"
import platformUILightDark from "./postcss/parseLightDark.mjs"
import wrapModulesInLayer from "./postcss/wrapModulesInLayer.mjs"
/**
* @typedef {import('postcss').Plugin | import('postcss').Processor} PostcssPlugin
* @typedef {{ breakpoints: Record<string, number>}} Config
*/
/** @type {Config} */
const DEFAULT_CONFIG = {
breakpoints: {
"xs": 380,
"sm": 576,
"md": 768,
"lg": 1024,
"xl": 1280,
"2xl": 1536,
},
}
/** @type {(config?: Partial<Config>) => PostcssPlugin[]} */
export function platformUIRequiredPlugins(config = {}) {
const { breakpoints } = {
breakpoints: {
...DEFAULT_CONFIG.breakpoints,
...config.breakpoints,
},
}
return [
injectBreakpoints({ breakpoints }), // Must run before tailwindcss
tailwindcss(),
platformUIFunctions(),
platformUIMixins({ breakpoints }),
postcssNested(),
// When browser support becomes adequate to use light-dark() directly, remove this plugin.
platformUILightDark(),
autoprefixer(),
wrapModulesInLayer(),
]
}
export default {
plugins: platformUIRequiredPlugins({}),
}