rehype-minify-javascript-url
rehype-minify-javascript-url
npm i rehype-minify-javascript-url
rehype-minify-javascript-url

rehype-minify-javascript-url

plugins to minify HTML

by rehypejs

4.0.0 (see all)License:MITTypeScript:Built-In
npm i rehype-minify-javascript-url
Readme

rehype-minify-javascript-url

Build Coverage Downloads Size Sponsors Backers Chat

Minify JavaScript URLs.

Install

This package is ESM only: Node 12+ is needed to use it and it must be importeded instead of requiredd.

npm:

npm install rehype-minify-javascript-url

This package exports no identifiers. The default export is rehypeMinifyJavaScriptUrl

Use

On the API:

 import {unified} from 'unified'
 import rehypeParse from 'rehype-parse'
+import rehypeMinifyJavaScriptUrl from 'rehype-minify-javascript-url'
 import rehypeStringify from 'rehype-stringify'

 unified()
   .use(rehypeParse)
+  .use(rehypeMinifyJavaScriptUrl)
   .use(rehypeStringify)
   .process('<span>some html</span>', function (err, file) {
     console.error(report(err || file))
     console.log(String(file))
   })

On the CLI:

rehype input.html --use minify-javascript-url --output output.html

Example

In
<img src="javascript:alert(true)">
Out
<img src="javascript:alert(!0)">

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

Downloads/wk

2.1K

GitHub Stars

65

LAST COMMIT

8mos ago

MAINTAINERS

2

CONTRIBUTORS

5

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
4.0.0
latest
1yr ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate