Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including remove-html-comments with all npm packages installed. Try it out:

var removeHtmlComments = require("remove-html-comments")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

remove-html-comments v1.0.2

Remove comments in html

NPM version Build Status Dependency Status

Remove comments in html


$ npm install --save remove-html-comments


var removeHtmlComments = require('remove-html-comments');

removeHtmlComments('<!DOCTYPE html><!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--><html lang="en"><head><meta charset="UTF-8"><title>Document</title></head><body></body></html>');
/*=> {
  data: '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title></head><body></body></html>',
  comments: [ '<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->' ]
} */
$ npm install --global remove-html-comments
$ remove-html-comments --help

    remove-html-comments <input-path>
    remove-html-comments <input-path> <output-path>
    cat <input-path> | remove-html-comments

    remove-html-comments index.html
    remove-html-comments index.html no-comments.html
    cat index.html | remove-html-comments
    cat index.html | remove-html-comments > no-comments.html

    -v, --verbose    Verbose output


MIT © Steve Mao

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free