Skip to content

Conversation

Shekhar0109
Copy link

Description

This PR adds a new audit to detect repeated CSS rules, as described in Issue #20.

Changes Made

  • Added audits/repeated-rules.js to check for duplicate property:value pairs across selectors.
  • Integrated the audit into the main runner (index.js).
  • Provided warnings with selector + property + value when duplicates are found.
  • Updated README.md to include the --repeated-rules audit and instructions on how to run it.

Why

Repeated CSS rules increase file size and can indicate poor maintainability.
This audit helps highlight them automatically and ensures the documentation reflects this new feature.

Testing Instructions

  1. Add CSS with duplicate rules, for example:
    .foo { border: 1px solid red; }
    .bar { border: 1px solid red; }

2.Run the audit tool:
npm run css-audit -- path/to/test.css --repeated-rules
3.Verify that duplicates are reported correctly.

##Checklist
[x]I have tested with a sample CSS file.
[x]Code follows project conventions.
[x]README updated with --repeated-rules audit instructions.

Fixes #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Audit Idea: Detect repeated rules in the CSS

1 participant