mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
21 lines
453 B
JavaScript
21 lines
453 B
JavaScript
import _ from 'lodash'
|
|
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 _.flatMap(styles, style => {
|
|
return postcss([
|
|
postcssNested({
|
|
bubble: ['screen'],
|
|
}),
|
|
]).process(style, {
|
|
parser: postcssJs,
|
|
}).root.nodes
|
|
})
|
|
}
|