Skip to content

Instantly share code, notes, and snippets.

@coen-hyde
Forked from twolfson/.gitignore
Created November 29, 2012 08:56
Show Gist options
  • Save coen-hyde/4167690 to your computer and use it in GitHub Desktop.
Save coen-hyde/4167690 to your computer and use it in GitHub Desktop.
Pretty print HTML but not JS test
/node_modules
var html = require('html'),
fs = require('fs'),
content = fs.readFileSync('minified.html', 'utf8'),
skipTags = ['script'],
prettyOptions = {'unformatted': ['script']},
beautifulContent = html.prettyPrint(content, prettyOptions),
beautifulContentDefault = html.prettyPrint(content);
// console.log(beautifulContent);
console.log(beautifulContentDefault);
<div><div><div><script>console.log('hey');console.log('what\'s up doc?');console.log('nada mucho senor');</script></div></div></div>
{
"name": "gist-4167514",
"version": "0.0.0",
"description": "Pretty print HTML but not JS test",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://gist.github.com/4167514.git gist-4167514"
},
"author": "Todd Wolfson",
"license": "MIT",
"dependencies": {
"html": "0.0.6"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment