zmoazeni / csscss

A CSS redundancy analyzer that analyzes redundancy.

Home Page:http://zmoazeni.github.io/csscss/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duplicate CSS selectors not returned int result

viveksachdeva opened this issue · comments

Code Snippet:

div.main {
width : 100%;
}

div.main {
background : white;
}

Expected output:
These two rules should be merged to one.

Actual output:
Nothing.

@viveksachdeva -- if these rules are in the same *.scss file, you might be able to solve your scenario with SCSS Lint.

However, I think this would still be an excellent enhancement, because I've recently taken over a codebase where someone, for some reason, duplicated a large amount of SCSS rules in the codebase (probably some sort of copy+paste error, or just ignorance). So, now the generated CSS is akin to this:

// line 101
.widget {
   color: red;
   width: 100px;
}

...

// line 3571
.widget {
   color: red;
   width: 100px;
}

There's some tools out there that will remove redundant CSS in the .css file, but I need to get rid of the extra rule definition all together in my .scss files. So, even just getting output which tells me what the duplicate selectors are would be extremely helpful!