Created
March 28, 2012 22:10
-
-
Save EndangeredMassa/2230984 to your computer and use it in GitHub Desktop.
A command-line script to strip out display:none declarations to include in your test runners
This file contains 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
#!/usr/bin/env coffee | |
CSSOM = require 'cssom' | |
fs = require 'fs' | |
if process.argv.length != 4 | |
console.log('Usage: ./hidey inputFile outputFile') | |
return | |
fileName = process.argv[2] | |
outputFileName = process.argv[3] | |
input = fs.readFileSync(fileName).toString() | |
parsed = CSSOM.parse(input) | |
output = '' | |
for rule in parsed.cssRules | |
output += "#{rule.selectorText} { display: none; }\r\n" if rule.style['display'] == 'none' | |
fs.open outputFileName, 'w', '0666', ( e, id ) -> | |
fs.write id, output, null, 'utf8', -> | |
fs.close id, -> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment