Created
February 7, 2017 14:17
-
-
Save henrahmagix/e53bfccd9ff2066a4e14dd3a08df25c1 to your computer and use it in GitHub Desktop.
Find all selectors in a CSS file. Requires https://github.com/tonyganch/gonzales-pe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var infile = 'mycssfile.css;' | |
var input = fs.readFileSync(infile).toString(); | |
var parseTree = require('gonzales-pe').parse(input); | |
var output = []; | |
parseTree.traverseByType('selector', node => output.push(node.toString())); | |
fs.writeFileSync('allselectors.txt', output.join('\n')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment