@aakashvaa/css-cleaner
v1.0.3
Published
A CLI tool to remove duplicate CSS/SCSS properties, keeping the last occurrence.
Maintainers
Readme
CSS Cleaner
A CLI tool to clean duplicate CSS/SCSS properties, keeping the last occurrence.
Installation
npm install --save-dev css-cleanerProject setup
{
"scripts": {
"clean": "css-cleaner src --recursive",
"clean:fix": "css-cleaner src --recursive --fix"
}
}You can optimise the cleaning process by giving the exact path of styles like : src/styles
- src => It's the relative path from the project root where the css-cleaner script will run.
Without Installing
{
"scripts": {
"clean": "npx @aakashvaa/css-cleaner src --recursive",
"clean:fix": "npx @aakashvaa/css-cleaner src --recursive --fix"
}
}
Using npm Scripts
- Check for duplicates:
npm run clean- Fix duplicates:
npm run clean:fix
Explanation:
clean:- Scans the
srcdirectory and all its subdirectories for.cssand.scssfiles. - Logs duplicate CSS/SCSS properties without modifying the files.
- Scans the
clean:fix:- Scans the
srcdirectory and its subdirectories for.cssand.scssfiles. - Automatically removes duplicate properties and overwrites the files.
- Scans the
Using css cleaner manually
css-cleaner <path-to-your-[.css/.scss] file>- example : css-cleaner styles.css/styles.scss
Direct CLI Usage
You can also run the tool directly if it’s installed globally:
- check:
css-cleaner <relative path to your styles> -r- fix:
css-cleaner <relative path to your styles> -r --fixNeed Help?
For detailed command options, use:
css-cleaner --help