rehype preset to minify HTML.
<!doctype html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<meta http-equiv="content-language" content="en-US">
<script src="index.js" type="text/javascript" language="javascript">
alert(true);
</script>
<link rel="stylesheet" href="index.css" type="text/css">
<title>Foo & bar</title>
</head>
<body>
<h1 class="foo foo">bar bar</h1>
<p id="alfred" id="alfred"> <strong>foo</strong> <em>bar</em> </p>
<button type="BUTTON" onclick="javascript:return false">Alpha</button>
</body>
</html>
<!doctypehtml><html lang=en-US><meta charset=utf8><script src=index.js></script><link rel=stylesheet href=index.css><title>Foo & bar</title><h1 class=foo>bar bar</h1><p id=alfred><strong>foo</strong> <em>bar</em></p><button type=button onclick=return!1>Alpha</button>
npm:
npm install rehype-preset-minify
The following plugins are included in the preset. They are mostly harmless (disclaimer: rehype-minify is quite young).
rehype-minify-attribute-whitespace
rehype-minify-css-style
rehype-minify-enumerated-attribute
rehype-minify-event-handler
rehype-minify-javascript-script
rehype-minify-javascript-url
rehype-minify-json-script
rehype-minify-media-attribute
rehype-minify-meta-color
rehype-minify-meta-content
rehype-minify-style-attribute
rehype-minify-whitespace
rehype-normalize-attribute-value-case
rehype-remove-comments
rehype-remove-duplicate-attribute-values
rehype-remove-empty-attribute
rehype-remove-external-script-content
rehype-remove-meta-http-equiv
rehype-remove-script-type-javascript
rehype-remove-style-type-css
rehype-sort-attribute-values
rehype-sort-attributes
The following plugins are not included because they are potentially dangerous. Read their readmes carefully before using!
rehype-concat-css-style
rehype-concat-javascript
rehype-css-to-top
rehype-javascript-to-bottom
rehype-minify-doctype
rehype-minify-url
rehype-prevent-favicon-request
rehype-format
— Format HTML
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, organisation, or community you agree to abide by its terms.