japgolly/scalacss

Compile-time CSS generation

Open

#88 opened on Jun 17, 2016

View on GitHub
 (9 comments) (6 reactions) (0 assignees)Scala (41 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (340 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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...

Contributor guide