css-dedoupe
Remove duplicate properties and declarations from your CSS
Built with ❤︎ by Tiaan and contributors
Table of Contents
About
This is a basic module that walks a AST built with reworkcss and removes duplicate CSS properties associated with a specific selector. Only keeping the most recent.
Install
$ npm install --save css-dedoupe# OR $ yarn add css-dedoupe
Usage
const cssDedoupe = const cssStr = '.float-right {float: right;}.float-right {float: right;}'console // '.float-right{float:right}'
CLI
$ css-dedoupe input.css output.css
Or if you would like to modify the input file directly:
$ css-dedoupe inputAndOutput.css
Issues
- Currently only supports to level declartions e.g. does not dedoupe declartions in media queries.
- The module makes no attempt to format the css after dedouping. Use modules like csscomb for this.
Contribute
Contributions are welcome. Please open up an issue or create PR if you would like to help out.
Note: If editing the README, please conform to the standard-readme specification.
License
Licensed under the MIT License.