UNPKG

@chassis/core

Version:

CSS4 pre-processor and responsive framework for modern UI development

15 lines (12 loc) 531 B
import postcss from 'postcss' import parser from 'postcss-scss' import CSSUtils from '../utilities/CSSUtils.js' export default postcss.plugin('chassis-hoist', (annotations, nodes) => { return (root, result) => new Promise((resolve, reject) => { const rule = CSSUtils.createRoot() nodes.forEach(node => rule.append(node)) // TODO: Find out why .toString() is required here- it shouldn't be annotations.hoist.replaceWith(parser.parse(rule, { from: 'chassis.hoisted-nodes' }).toString()) resolve(root) }) })