strip-comment
Strip js, css, and html comments.
Install
npm install strip-comment --save
test
mocha
demo
<!-- html comment -->This is a paragraph.// html content
var fs = ;var html = fs;var strip = ; ; // Strip js css and html comments.
API
strip(code, keep)
Strip html css and js comments
- {string}
code
required - {boolean}
keep
[keep = false]
Keep the source code lines and columns
.js(code, keep)
Strip js comments
- {string}
code
required - {boolean}
keep
[keep = false]
var js = 'var a = 3; // comment'strip;strip; // keep code lines
.css(code, keep)
Strip css comments
- {string}
code
required - {boolean}
keep
[keep = false]
var css = 'h2 { /* comment */ font-size : 18px; }'strip;
.html(code, keep)
Strip html comments
- {string}
code
required - {boolean}
keep
[keep = false]
var html = '<!-- html comment --><div></div>'strip;