Yeah, the following *should* work:
var foo = @CSS(`background-color: red;`);
document .. @appendContent( @Body .. foo);
But it doesn't, because @appendContent doesn't work for "document",
which, in turn, is caused by "insertAdjacentHTML" not being defined on
"document".
It can be fixed (and we should fix it!), but fwiw it feels a bit odd
to add/remove body elements to a document and have @CSS scope & track
CSS for it.
What we usually do is to either add a global stylesheet (via <link> or
@RequireExternalCSS), or inject global CSS into the document using an
@global declaration in @CSS that is attached to some element in the
document, e.g.:
var my_global_css = @CSS(`
@global {
body { background-color: red; }
}
`);
var my_main_container = @Div(...);
document.body .. @appendContent(
my_main_container .. my_global_css
);
> --
> You received this message because you are subscribed to the Google Groups
> "StratifiedJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
stratifiedjs...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.