Isn't this the same as Styletron is doing? https://www.styletron.org
Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs
11–20 of 51 posts
Re: Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs
#12Re: Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs
#13So you took something written in a regular grammar and made it into the same thing except with a very complex context free grammar with support for recursion? I hate to be a grumpy puss but using this sounds like a step backwards.
So, engineers working on UI toolkits often reach for CSS code generation to ease maintenance. At first it was all PHP templates. Then it was Sass (206), is a popular purpose-built language for generating CSS which saw a lot of use in the Rails community. Sass is very good at its job because it handles a lot of CSS niceties in nice ways, but it’s a lot of extremely domain specific complexity. A whole new Turing-complete language JUST for CSS? Not ideal.
The next step is to move all the UI definition into a single place, i using a single language that abstracts the underlying HTML/CSS/JS files & semantics. We do that by writing JS, and having a compiler program extract the CSS bits. This gets us ideal performance & ideal maintainability at the cost of build complexity. This is a worth while trade, because in the long run the compiler will get so good that the cost becomes minimal; compare to other ecosystems, for example the Kotlin compiler is quite complex, but I never think about x86 assembly when writing Kotlin.
Re: Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs
#14Re: Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs
#15The differentiating feature of Atlassian’s @compiled package is not the “build time atomic css” - it’s that you can distribute components that use @compiled on NPM without requiring your consumer to futz with Webpack include paths for e.g. CSS files. Do I have that right? @madou is the extraction shipping yet? The docs have a few places that say “coming in 2021” - what’s the status? For those interested in build-time…
It marries in-line style props (like JSXStyle) with SwiftUI style stack views.
It’s very much alpha, on my GitHub.
Re: Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs
#16Re: Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs
#17The differentiating feature of Atlassian’s @compiled package is not the “build time atomic css” - it’s that you can distribute components that use @compiled on NPM without requiring your consumer to futz with Webpack include paths for e.g. CSS files. Do I have that right? @madou is the extraction shipping yet? The docs have a few places that say “coming in 2021” - what’s the status? For those interested in build-time…
Re: Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs
#18Re: Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs
#19 - 0.7 KB (gzipped)
- Zero dependencies
- High performance ("fast af")
- Deduplicates repeated styles
- Dead-code elimination
- Media queries and pseudoclasses supported
Works with any framework or with none, apparently, although I've only used it with Preact. Supports themes. Everything I need and nothing I don't.Re: Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs
#20Yet another case of documentation saying “JS” when they mean “React, specifically”. Every single example I can see here uses React, but if this deserves the CSS-in-JS moniker, please give at least one example of usage with vanilla JS. It’s like peak jQuery all over again.