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
- Host: GitHub
- URL: https://github.com/sspirou/dead-styles-shear
- Owner: sspirou
- License: mit
- Created: 2020-03-12T12:58:10.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-01T04:24:45.000Z (about 5 years ago)
- Last Synced: 2025-01-19T07:42:10.616Z (4 months ago)
- Topics: css-selector-parser, css-selectors, pagespeed, python27, selectors, web
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.