What is rehype-minify-whitespace?
The rehype-minify-whitespace package is a plugin for the rehype ecosystem that minifies whitespace in HTML. It helps in reducing the size of HTML files by removing unnecessary whitespace, which can improve load times and overall performance.
Minify Whitespace
This feature minifies the whitespace in the provided HTML string. In the example, the excessive spaces between 'Hello' and 'World' are removed.
const rehype = require('rehype');
const minifyWhitespace = require('rehype-minify-whitespace');
rehype()
.use(minifyWhitespace)
.process('<div> Hello World </div>', function (err, file) {
if (err) throw err;
console.log(String(file));
});