Can the SASS minifier remove duplicate styles?
css, sass
Solution
I think that I may have found a way to at least find the duplicate styles in both css and sass/less templates:
The open source csscss gem http://zmoazeni.github.io/csscss/
It appears to be able to detect duplicates, although I am having to monkey patch around the bootstrap-sass gem's css not being in the same folder as my css assets.
From the documentation, you can run:
$ csscss -v path/to/styles.css
or
$ csscss -v path/to/styles.css.scss
Problem
I know that the css rules are fairly complex; however, couldn't the following css be fairly simply reduced in a number of ways by the optimizer? And if so, is there an option for it in the rails-sass gem? ``` span { background: red; color: green; } .test2 { background: red; color: green; } span { background: green; color: inherit; } .test2 { background: inherit !important; color: inherit; color: inherit; color: inherit; } ``` Additional Context: To help clarify, I would propose the following as well... Source: ``` span { background: red; } span { background: orange; color: green; } span { background: yellow; } span { background: blue; color: green; } ``` And, I would want a compiler to generate the following: ``` span { background: blue; color: green; } ``` I know there are redundant styles, but this happens many times when continually revising stylesheets, and I want to eliminate the dead code.