Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit Idea: Detect repeated rules in the CSS #20

Open
ryelle opened this issue Jan 7, 2021 · 2 comments
Open

Audit Idea: Detect repeated rules in the CSS #20

ryelle opened this issue Jan 7, 2021 · 2 comments
Labels
help wanted Extra attention is needed New Audit

Comments

@ryelle
Copy link
Collaborator

ryelle commented Jan 7, 2021

If we run this over a file, it should pull out any place where a property: value; repeats. For example, this should return [ 'border: 1px solid red' ].

.foo {
    padding: 20px;
    border: 1px solid red;
}
.bar {
    padding: 10px;
    border: 1px solid red;
}
@ryelle
Copy link
Collaborator Author

ryelle commented Feb 18, 2021

Try looking at postcss-discard-duplicates for inspiration on how to do this.

@ryelle
Copy link
Collaborator Author

ryelle commented Mar 18, 2021

The flip side to this could be checking for repeated selectors - so this would return [ .foo ].

.foo {
    border: 1px solid red;
}
.foo {
    display: grid;
}

@ryelle ryelle added New Audit help wanted Extra attention is needed labels Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed New Audit
Projects
None yet
Development

No branches or pull requests

1 participant