html-compressor
html-compressor
Middleware to compress the HTML content while serving.
Installing
Using npm:
$ npm install html-compressor
Method
var express = ;var htmlCompressor = ;
var app = ;app;
Options
app;
default options>>
- remove comments
- remove white space
- remove empty attributes
- remove attribute quotes
- collapse Boolean attribute
These default options are able to minify the html content but for css and js we can pass the option for that.
Option | type | default | description |
---|---|---|---|
css | Boolean | false | To minify css of html |
js | Boolean | false | To minify js of html |
comments | Boolean | true | To remove comments from html |
render | Boolean | true | It will modify default response.render function for all |
custom | String | null | It will use to create the custom render function |
debug | Boolean | false | If true, then it will show the message when unable to minify html due to error |
Default Compress Function (renderCompress)>> renderCompress is default compress function we can use response.renderCompress to render compress html
example
var express = ;var htmlCompressor = ;var app = ;app; app
licence
MIT licence
Author
@BCrazyDreamer