stylis
Use stylis as the parser, this will make a runtime version more viable
👍
yo @thysultan, thanks or showing up! quick question - is it possible for stylis to return the parsed rules as an array, instead all concatenated into a string? This will make it possible to use insertRule. Thanks!
It is possible with a middleware, ex.
function plugin (context, block, line, column, id, length) {
switch (context) {
// executed whenever a block of css is done compiling.
case 5: case 6: rules.push(block);
// or directly interface with insertRulle
// case 5: case 6: styleSheet.insertRule(block, length)
}
}
Since it could become a common pattern this could be added to be built into stylis in the V3 rewrite, ex.
const rules = [];
stylis.set({
output: rules
})
// rules
[
'selector {...body}'
]
// or
const rules = {};
stylis.set({
output: rules
})
// rules
{
'selector': '...body'
}
@threepointone do you still want to do this? I want to add keyframes but I think this should be done first if we are going with it.
Not high priority for now.