tailwindcss/src/util/parseObjectStyles.js

20 lines
429 B
JavaScript
Raw Normal View History

2018-03-05 16:32:22 -05:00
import postcss from 'postcss'
import postcssNested from 'postcss-nested'
import postcssJs from 'postcss-js'
2018-03-05 16:32:22 -05:00
export default function parseObjectStyles(styles) {
2018-03-05 16:32:22 -05:00
if (!Array.isArray(styles)) {
return parseObjectStyles([styles])
}
return styles.flatMap((style) => {
2019-05-27 08:05:51 +02:00
return postcss([
postcssNested({
bubble: ['screen'],
}),
]).process(style, {
parser: postcssJs,
}).root.nodes
})
2018-03-05 16:32:22 -05:00
}