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: Styletron – Virtual CSS

109 pointsby rtsaoover 8 years ago

8 comments

wolfgang42over 8 years ago
This isn&#x27;t specifically to do with Styletron, but I&#x27;m wondering: what is the use case for building arbitrary CSS from JavaScript? I&#x27;ve never written an app where this seemed necessary; the most I&#x27;ve ever needed is some semantic classes to apply, like this:<p><pre><code> .request-pending {background-color: $yellow;} .request-acknowledged {background-color: $green;} </code></pre> It seems like mixing the actual styles in with the JS violates separation of concerns and clutters up the actual logic.
评论 #13134910 未加载
评论 #13134342 未加载
评论 #13133219 未加载
trueadmover 8 years ago
Great work! Styletron looks awesome and the performance definitely fits well with some of the apps I work with. I&#x27;ll give it a try :)
matchuover 8 years ago
I&#x27;m curious about this limitation:<p>&gt; Descendant and child combinators are unsupported<p>Are conditional applications of rules also unsupported, like `:hover` and media queries? That&#x27;s a big deal in terms of runtime perf, too.
评论 #13133993 未加载
kevinyunover 8 years ago
Am I having a hard time understanding this CSS in JS concept, and therefore Styletron, if I&#x27;ve never worked with React before? Let&#x27;s say at a basic level, I have compiled stylesheets -- could you explain in simple web developer layman&#x27;s terms how this could be implemented, knowing the benefit of reduced file size and increased performance is what were aiming for?
bostonvaulter2over 8 years ago
Looks nice but I don&#x27;t like the lack of pseudo selectors:<p>From the footnotes:<p>&gt; The one area where this is useful is combining descendant combinators with pseudo classes, the most common use case being where hovering a parent triggers a style change in a descendant node. However, this behavior be implemented in JavaScript with event listeners and explicit state changes if needed.
评论 #13119198 未加载
doublerebelover 8 years ago
tl;dr: deduplication processing for CSS speeds CSS compilation and produces smaller file sizes. Cool!<p>The article only has compilation performance tests, and there&#x27;s a small mention in the docs: How does Styletron affect render speed in the browsers?<p>Also, what tool are you using to convert existing CSS to JS objects?
评论 #13133435 未加载
k__over 8 years ago
Sounds awesome.<p>I got the same idea, when I looked at javascript style sheets.<p>&quot;We don&#x27;t do inline styles, we generate classes!&quot;<p>If they already generate, why not merge the whole stuff?
qz_over 8 years ago
I love how your blog looks.
评论 #13133691 未加载