An open API service indexing awesome lists of open source software.

https://github.com/sspirou/dead-styles-shear

Py script for trimming dead style rules from a website directory
https://github.com/sspirou/dead-styles-shear

css-selector-parser css-selectors pagespeed python27 selectors web

Last synced: 2 months ago
JSON representation

Py script for trimming dead style rules from a website directory

Awesome Lists containing this project

README

        

# dead-styles-shear
Py scripts for identifying and trimming dead style rules from a website directory. Written in python 2.7

----------
### Identify Dead Style Rules

`findDeadStyles.py pathToDirectory [ignoreJS]`
- recursively search the input directory for html and javascript files to build a list of all selectors being used
- pass `ignoreJS` to optionally only crawl html files when building used selectors list
- recursively search the input directory for css and scss files to build a list of all style rules
- write output file, deadStyles.css, listing all dead styling rules in input directory

##### Output:
- deadStyles.css - valid css file containing each unused selector listed on its own line followed by `{}`
----------
### Trim Dead Style Rules [TODO]

`trimStyles.py pathToDirectory [ignoreJS]`
- mimics behavior above to generate list of dead style rules, then finds each dead rule in the list and removes it from input directory's css files.