1.1.0 • Published 7 years ago

reshape-minify v1.1.0

Weekly downloads
83
License
MIT
Repository
github
Last release
7 years ago

reshape-minify

npm tests dependencies coverage

A reshape plugin to minify html

Note: This project is in early development, and versioning is a little different. Read this for more details.

Installation

npm install reshape-minify -S

Note: This project is compatible with node v6+ only

Usage

Add it as a plugin to reshape:

const reshape = require('reshape')
const minify = require('reshape-minify')

reshape({ plugins: minify(/* options */) })
  .process(someHtml)
  .then((res) => {
    console.log(res.output(/* locals */))
  })

Options

Options are passed in an object, all are optional.

NameDescriptionDefault
collapseWhitespaceRemoves all extra whitespacetrue
conservativeCollapseInstead of fully removing excess whitespace, collapses down to a single spacefalse
aggressiveCollapseMore aggressive whitespace removal, trims all whitespace from beginning and ends of any textfalse
removeCommentsRemoves all comments from the htmltrue
minifyCssMinifies any CSS in style tagstrue
minifyJsMinifies any JS in script tagstrue
minifySvgMinifies any inline svgtrue
minifyJsonMinifies any json in script tags with */json as the typetrue

To-Do List

License & Contributing