japgolly/scalacss

Compile-time CSS generation

Open

#88 aperta il 17 giu 2016

Vedi su GitHub
 (9 commenti) (6 reazioni) (0 assegnatari)Scala (41 fork)github user discovery
enhancementhelp wanted

Metriche repository

Star
 (340 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

It would be fantastic to generate CSS at compile-time instead of runtime, mainly because it would reduce the output JS size to near zero, making #72 obsolete.

Example:

val abc = style(display.block)
// Macro turns ↑ into something like ↓
val abc = StyleA(…, PreGeneratedCss("display:block"))

It would have to handle autoprefixing too.

How/could it determine whether variables are static/dynamic to handle marginLeft(zzz.px * 2)?

Even if it just takes care of the easy, static cases, I wonder how large the JS size savings could be...

Guida contributor