Minify HTML Stream
Strips whitespace from an HTML stream to reduce the size of the final payload.
Install
Install with npm
npm install --save minify-html-stream
Simple Example
"use strict"; const fetch = ;const Minifier = Minifier; ;
How You Might Use It
"use strict"; // Declare variablesconst http = ;const talisman = ;const Minifier = Minifier; // Start a serverconst server = http; // Start listeningserver;
Configuration
stripCarriageReturns: true // remove carriage return characters (\r) trimLines: true // remove whitespace from the ends of lines trimElements: true // remove whitespace from around elements where it is safe normalizeWhiteSpace: true // normalize multiple whitespace characters to single characters stripComments: true // remove HTML comments (except conditional comments)
Notes
Minify HTML Stream is really naïve and conservative about how it goes about minification, because it sort of has to be. Pull requests are most welcome.
Published under the MIT License.