Am I missing something? UnCSS has been for about 3 years now. http://bit.ly/uncss by addyosmani
UnCSS: Remove unused styles from CSS
31–40 of 50 posts
Re: UnCSS: Remove unused styles from CSS
#32I've been hoping someone would write a similar tool, but using a browser, so that I could run a webapp, click around (using a checklist, to cover all of the views) and get a resulting list of used CSS rules from the browser. That would have the advantage of supporting complex webapps written in any language/environment.
States can quickly become complex. Like styles for a logged in user with a 3-years-membership badge or styles for a placeholder that only new users see. Or styles for a CMS module that is currently not in use (e.g. for open positions in a company). I wonder what the least used, yet still used CSS is I ever wrote (relative to project traffic). Maybe some feature a Client requested, I knew he would never really use, bu…
Re: UnCSS: Remove unused styles from CSS
#33I've been hoping someone would write a similar tool, but using a browser, so that I could run a webapp, click around (using a checklist, to cover all of the views) and get a resulting list of used CSS rules from the browser. That would have the advantage of supporting complex webapps written in any language/environment.
Every visitor had a small probabillity it would run the code, and after a couple of million visitors, they had a pretty good idea of what styles were unused.
Re: UnCSS: Remove unused styles from CSS
#34I've been hoping someone would write a similar tool, but using a browser, so that I could run a webapp, click around (using a checklist, to cover all of the views) and get a resulting list of used CSS rules from the browser. That would have the advantage of supporting complex webapps written in any language/environment.
Etsy did something like that, but on the production site. Every visitor had a small probabillity it would run the code, and after a couple of million visitors, they had a pretty good idea of what styles were unused.
A large user base would give you decent coverage.
Re: UnCSS: Remove unused styles from CSS
#35Have used tools like this before, and invariably end up accidentally stripping styles from an component with a dynamically assigned className or something equally silly. It's such a hard problem to solve and the Stylesheet Snowball is one of the most frustrating pieces of technical debt a large site can pick up. It makes me wonder if scoped CSS modules, despite fundamentally breaking CSS with their hyper specific hyb…
Re: UnCSS: Remove unused styles from CSS
#36Re: UnCSS: Remove unused styles from CSS
#37Would this work if you print classnames with php?
Re: UnCSS: Remove unused styles from CSS
#38I wonder what the performance increase would be of loading one big CSS file on the first page load and serving from local cache from then on, vs loading a smaller but different CSS file for each page you visit. My impression is that number of requests is a more critical optimization than file size (at least when serving CSS sized files)
Re: UnCSS: Remove unused styles from CSS
#39Have used tools like this before, and invariably end up accidentally stripping styles from an component with a dynamically assigned className or something equally silly. It's such a hard problem to solve and the Stylesheet Snowball is one of the most frustrating pieces of technical debt a large site can pick up. It makes me wonder if scoped CSS modules, despite fundamentally breaking CSS with their hyper specific hyb…
Re: UnCSS: Remove unused styles from CSS
#40I've been hoping someone would write a similar tool, but using a browser, so that I could run a webapp, click around (using a checklist, to cover all of the views) and get a resulting list of used CSS rules from the browser. That would have the advantage of supporting complex webapps written in any language/environment.
It is, though, limited to the context of a single page. You can't browse several pages and then see what the net unused css is.
I believe, though, extensions can talk to dev tools, so there's some plausible way to extend it.