TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Compiled, buildtime atomic CSS in JavaScript and all your favorite APIs

47 pointsby madouover 4 years ago

13 comments

tobrover 4 years ago
Yet 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.
评论 #25611918 未加载
jitlover 4 years ago
The 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?<p>For those interested in build-time CSS in JS, also called Zero-runtime CSS in JS, you might also want to check out:<p>- Linaria (<a href="https:&#x2F;&#x2F;github.com&#x2F;callstack&#x2F;linaria" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;callstack&#x2F;linaria</a>) I use on my personal site. I ran into trouble&#x2F;bugs trying to integrate it with Notion’s build process; the Webpack&#x2F;babel bits are very brittle.<p>- Treat requires that you write the JS that computes your styles in esperare xxx.treat.js files which is annoying from my point of view - I want single file components. (<a href="https:&#x2F;&#x2F;seek-oss.github.io&#x2F;treat&#x2F;" rel="nofollow">https:&#x2F;&#x2F;seek-oss.github.io&#x2F;treat&#x2F;</a>)<p>- No idea about this one, but it’s more recent. Has some other interesting things in the inspiration section of the README <a href="https:&#x2F;&#x2F;github.com&#x2F;CraigCav&#x2F;css-zero" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;CraigCav&#x2F;css-zero</a>
评论 #25611463 未加载
评论 #25611325 未加载
swileyover 4 years ago
So 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?<p>I hate to be a grumpy puss but using this sounds like a step backwards.
评论 #25611283 未加载
austinjpover 4 years ago
Personally I&#x27;m a fan of cxs [0] which is (or purports to be) atomic among other strengths. From the readme:<p><pre><code> - 0.7 KB (gzipped) - Zero dependencies - High performance (&quot;fast af&quot;) - Deduplicates repeated styles - Dead-code elimination - Media queries and pseudoclasses supported </code></pre> Works with any framework or with none, apparently, although I&#x27;ve only used it with Preact. Supports themes. Everything I need and nothing I don&#x27;t.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;cxs-css&#x2F;cxs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cxs-css&#x2F;cxs</a>
评论 #25614785 未加载
christophilusover 4 years ago
There are already quite a few alternatives in the comments, but I’ll just add that I have really come around to the Tailwind way of doing this. On my current project, I haven’t had to write much CSS at all other than a handful of animations, and it all looks consistent and custom. It’s a breath of fresh air.
评论 #25660061 未加载
iddanover 4 years ago
I was building a similar solution 4 years ago [1] but got stuck with integration to Webpack. I’m very glad someone succeeded to do so. [1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;iddan&#x2F;stylesheet" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;iddan&#x2F;stylesheet</a>
fastballover 4 years ago
Doesn&#x27;t @emotion&#x27;s babel plugin already do this, or am I missing something?
评论 #25611141 未加载
pestatijeover 4 years ago
What was wrong again with runtime CSS? By the smell of it seems to be performance, so: can somebody point to performance comparisons, or give a brief of the advantages?
评论 #25612907 未加载
评论 #25614733 未加载
piiover 4 years ago
hamburger emoji for a menu icon is for sure an underused design pattern
评论 #25613666 未加载
Traubenfuchsover 4 years ago
Could someone please explain the following line to me?<p>export const Button = styled.button``;<p>Why is there a string right after the field &quot;button&quot; of the object &quot;styled&quot;? How is this valid JS? What does it do?
评论 #25614171 未加载
评论 #25614178 未加载
评论 #25614116 未加载
niksmacover 4 years ago
Isn&#x27;t this the same as Styletron is doing? <a href="https:&#x2F;&#x2F;www.styletron.org" rel="nofollow">https:&#x2F;&#x2F;www.styletron.org</a>
评论 #25611185 未加载
mouzoguover 4 years ago
why is there such a prevalence of mawkish phraseology in the javascript community...<p>i was reading the landing page for a js library and it said something like &quot;battery-pack included&quot;, makes me feel kind sick....or maybe i&#x27;m just a grumpy sod
评论 #25613694 未加载
crituquieover 4 years ago
why? css exists because one shoud not need js just for styling! js is dangerous for me!