mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-05 07:39:30 +08:00
19 lines
429 B
Text
19 lines
429 B
Text
import postcss from 'postcss'
|
|
import postcssNested from 'postcss-nested'
|
|
import postcssJs from 'postcss-js'
|
|
|
|
export default function parseObjectStyles(styles) {
|
|
if (!Array.isArray(styles)) {
|
|
return parseObjectStyles([styles])
|
|
}
|
|
|
|
return styles.flatMap((style) => {
|
|
return postcss([
|
|
postcssNested({
|
|
bubble: ['screen'],
|
|
}),
|
|
]).process(style, {
|
|
parser: postcssJs,
|
|
}).root.nodes
|
|
})
|
|
}
|