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: Polished – A lightweight toolset for writing styles in JavaScript

106 pointsby mxstbrabout 8 years ago

13 comments

debaserab2about 8 years ago
This tool seems useful if you buy into the philosophy, but I&#x27;m just not sold yet - component based styling leads to a lot of style duplication and makes it very easy for a developer to go &quot;off the playbook&quot; when it comes to enforcing a consistent styleguide throughout an app.<p>The idea that &quot;globals&quot; in CSS are bad is counter intuitive to my experience that globals in CSS encourage consistency<p>Maybe when you&#x27;re facebook size and you have many product teams all expected to produce something that all works together - I can see how the global namespace would be impossible to manage. For your average website or app? Not even close. It&#x27;ll be awhile before you run into the limitations of CSS that Facebook is running into.
评论 #13977780 未加载
评论 #13978074 未加载
评论 #13978173 未加载
评论 #13980670 未加载
评论 #13977674 未加载
评论 #13978704 未加载
onliabout 8 years ago
I&#x27;m not 100% what this is exactly... Care to clear it up a bit?<p>At first I though this is for those situations where you find yourself urged to modify the css in your javascript. But looking at the documentation, this seems to be a way to write the complete CSS in JS, and then to have it compiled into CSS. Do I understand that wrong? If not: Why would one want that?
评论 #13977308 未加载
评论 #13977383 未加载
评论 #13977295 未加载
tobltobsabout 8 years ago
The current state of the JS world is getting closer every day to the J2EE craziness about 10 years ago. As an outsider it was nearly impossible to understand for what all those frameworks with funky names were required at all. For an insider every of those new frameworks looked like the solution to a fundamental CS problem. However, those fundamental CS problems where nothing else then some shortcomings introduced by the latest framework before.
评论 #13977792 未加载
osobaabout 8 years ago
Wouldn&#x27;t these two lines of code do the same thing?<p><pre><code> var addCSS = (css) =&gt; { window.document.styleSheets[0].insertRule(css, window.document.styleSheets[0].cssRules.length); }; addCSS(&#x27;.x { color: red; width: 5px; }&#x27;); </code></pre> Test examples (+ another version that can add multiple selectors in the same line): <a href="https:&#x2F;&#x2F;jsfiddle.net&#x2F;xkLnj9st&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jsfiddle.net&#x2F;xkLnj9st&#x2F;</a>
michaelmiorabout 8 years ago
Perhaps Show HN would be more appropriate than &quot;just launched&quot;?
评论 #13977316 未加载
juandazapataabout 8 years ago
Can somebody explain how this approach affects the style caching by the browser? It seems that this will just throw away all the caching optimizations built around that.
评论 #13978739 未加载
abritinthebayabout 8 years ago
I&#x27;m a massive CSS-in-JS skeptic but this is a very nicely thought out low-level tool for that stack.<p>It&#x27;s basically a JS version of SASS mixins (kinda).<p>Most of my objections to CSS-in-JS are they are all poorly architected high-level abstractions taking a bad solution to a lower level problem.<p>This feels like a good basis for a higher level tool that doesn&#x27;t suck.<p>And like I said - I say that as someone broadly skeptical of the whole topic.
rattrayabout 8 years ago
Mods: consider linking to the project homepage, <a href="https:&#x2F;&#x2F;polished.js.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;polished.js.org&#x2F;</a> which appears to give much more context
评论 #13977623 未加载
评论 #13977624 未加载
analogmemoryabout 8 years ago
I&#x27;m coming around slowly but I still have a hard time with css being embedded in JS components. I have used SCSS for so long I am used to style and function being separate concerns and separate files. I like the idea of being able to use &#x27;mixins&#x27; for js components.
k__about 8 years ago
Also interesting, for people who fear style duplication: <a href="http:&#x2F;&#x2F;styletron.js.org" rel="nofollow">http:&#x2F;&#x2F;styletron.js.org</a>
评论 #13978751 未加载
gibbitzabout 8 years ago
I found that the killer application for Javascript would be to write github repos for Javascript wrappers for typescript. Seriously, why is CSS as Javascript objects a thing? Are we so bored with the stack we&#x27;ve been using that we can only make things interesting by cross compiling everything? It makes me think of this video: <a href="https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;the-birth-and-death-of-javascript" rel="nofollow">https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;the-birth-and-death...</a>
评论 #13977243 未加载
jlebrechabout 8 years ago
i&#x27;d like a relative positioning framework for css, to clamp anchors point relative to each other. that stuff is HARD in CSS
hmansabout 8 years ago
No.
评论 #13978535 未加载