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.

Csscss: a CSS redundancy analyzer that analyzes redundancy

299 pointsby zmoazeniabout 12 years ago

18 comments

geuisabout 12 years ago
This could be an interesting companion to Helium. Helium-css can be used on live sites to find unused CSS. Combine with this project to remove duplicates too. <a href="https://github.com/geuis/helium-css" rel="nofollow">https://github.com/geuis/helium-css</a>
评论 #5526446 未加载
评论 #5529151 未加载
laurenceiabout 12 years ago
Personally I used Chrome dev tools - and it has a feature called 'CSS Selector Profiles' under the 'profile' tab.<p>You can 'record' yourself using a website - and Chrome records how many 'hits' each css rule gets.<p>This is better than Dust-me, and all the other CSS rule detectors - because it allows you to use your site in a 'dynamic' way - and test for all the edge CSS cases (like resizing your browser to small, or enabling an error message etc).<p>After using my SaaS for an hour - I found hundreds of rules that just never got used.<p>Also - it tells you how many times a rule got used. So I found a few number of rules that literally only got used once, and I could often re-write them into 1-2 bigger rules - further reducing my CSS overhead.
评论 #5532310 未加载
sergiotapiaabout 12 years ago
From the makers of the phenomenal Chosen jquery plugin.<p><a href="http://harvesthq.github.io/chosen/" rel="nofollow">http://harvesthq.github.io/chosen/</a><p>Hopefully this is indicative of the quality of this library! I'll definitely try it out this morning.
评论 #5525838 未加载
laumarsabout 12 years ago
It's rare that I feel any particular emotion towards project names, but the name and description behind this one is inspired.
评论 #5528292 未加载
评论 #5528753 未加载
zmoazeniabout 12 years ago
If you're a ruby developer I strongly encourage you to check out the source code and parsing in general. This is heavily using parslet [1] to build a css parser [2]. I'm sure there are edge cases I have missed, but still the LOC for this codebase is relatively small and fairly readable.<p>Stay away from the RedundancyAnalyzer though. There be dragons.<p>[1] <a href="http://kschiess.github.io/parslet/" rel="nofollow">http://kschiess.github.io/parslet/</a><p>[2] <a href="https://github.com/zmoazeni/csscss/tree/ae2f22f4416bca35f903970c15aa1685a8d237cd/lib/csscss/parser" rel="nofollow">https://github.com/zmoazeni/csscss/tree/ae2f22f4416bca35f903...</a>
moonbootsabout 12 years ago
CSSO [1] is a tool that removes duplicate declarations during minification instead of just warning about them. It also performs more advanced structural optimizations.<p>[1] <a href="http://bem.info/tools/csso/" rel="nofollow">http://bem.info/tools/csso/</a>
评论 #5526057 未加载
评论 #5525558 未加载
tlrobinsonabout 12 years ago
I love the name and tag line.
评论 #5525642 未加载
antimoraabout 12 years ago
Here is something I came across at PyCon. This technique uses genetic algorithm to minimize the CSS. The author claims 10% improvement over the standard CSS minimizer.<p>Links:<p>- <a href="https://us.pycon.org/2013/schedule/presentation/178/" rel="nofollow">https://us.pycon.org/2013/schedule/presentation/178/</a><p>- <a href="https://github.com/ryansb/genetic-css" rel="nofollow">https://github.com/ryansb/genetic-css</a>
Snowdaabout 12 years ago
This. This makes me smile. For the name, tagline and the application.
nemrowabout 12 years ago
I bookmarked this for sure! I'm the WORST at having tons of duplicate declarations!
pindiabout 12 years ago
It seems like when run on SCSS mode, it expands mixins before running the redundancy check. For instance, two of my selectors both include three of the same mixins, which end up expanding into 23 rules, and CSSCSS reports 25 shared rules between them. (Further inspection confirms that exactly 2 normal rules are shared.)<p>I would think that using mixins should also count as having eliminated redundancy. A simple solution would be to ignore them, or more ideally the redundancy check could treat mixins just as a normal rule, so that it could detect using the same set of mixins in multiple places as redundancy.
评论 #5526527 未加载
harlanlewisabout 12 years ago
Great!<p>But, one issue. It appears to not support @import of Compass extensions: "File to import not found or unreadable."
notdonspauldingabout 12 years ago
I'm upvoting this is for the cleverly redundant title that repeats itself and causes me to vote it up.
fungiabout 12 years ago
We really need this, our css has grown in to a monster over the years.<p>This may also be of interest:<p>Dust-Me Selectors is a firefox extension that scans HTML pages to find unused CSS selectors. <a href="http://www.brothercake.com/dustmeselectors/" rel="nofollow">http://www.brothercake.com/dustmeselectors/</a>
alex_doomabout 12 years ago
Brilliant, I was just searching for a tool for this.
michaelwwwabout 12 years ago
Noob question: how do I know the selectors and inheritance rules are applied in the same way as the target platform?
mattyodabout 12 years ago
Should have run an analyser against the sub heading for that article.
评论 #5526837 未加载
评论 #5529497 未加载
tylerhowarthabout 12 years ago
Any support for scss/sass planned?
评论 #5528061 未加载