unified

Project: rehypejs/rehype-minify

Package: rehype-remove-comments@4.0.2

  1. Dependencies: 2·Dependents: 6
  2. rehype plugin to remove comments (except conditional comments)
  1. unified 165
  2. plugin 128
  3. html 110
  4. rehype 73
  5. rehype-plugin 51
  6. minify 30
  7. mangle 30
  8. comment 7

rehype-remove-comments

Build Coverage Downloads Size Sponsors Backers Chat

Remove comments (except conditional comments).

When configured with force: true (default: false), conditional comments are also removed.

Install

npm:

npm install rehype-remove-comments

Use

On the API:

 unified()
   .use(require('rehype-parse'))
+  .use(require('rehype-remove-comments'))
   .use(require('rehype-stringify'))
   .process('<span>some html</span>', function (err, file) {
     console.error(report(err || file))
     console.log(String(file))
   })

On the CLI:

rehype input.html --use remove-comments > output.html

Example

In
<!--Hello-->
<!--[if IE 6]>OK<![endif]-->
Out
<!--[if IE 6]>OK<![endif]-->

Contribute

See contributing.md in rehypejs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer