1.2.1 • Published 7 years ago
hoast-minify v1.2.1
hoast-minify
Minify CSS, HTML, and JS files using clean-css, html-minifier, and terser respectively.
As the name suggest this is a hoast module.
Usage
Install hoast-minify using npm.
$ npm install --save hoast-minifyParameters
css: Options forclean-css.- Type:
Object* Default:{}
- Type:
html: Options forhtml-minifier.- Type:
Object* Default:{ collapseWhitespace: true, removeComments: true }
- Type:
js: Options forterser.- Type:
Object* Default:{}
- Type:
patternsCSS: Glob patterns to match file paths with that will be processed byclean-css.- Type:
StringorArray of stringsDefault: `[ '.css' ]`
- Type:
patternsHTML: Glob patterns to match file paths with that will be processed byhtml-minifier.- Type:
StringorArray of stringsDefault: `[ '.html' ]`
- Type:
patternsJS: Glob patterns to match file paths with that will be processed byterser.- Type:
StringorArray of stringsDefault: `[ '.js', '*.mjs' ]`
- Type:
patternOptions: Options for the glob pattern matching. See planckmatch options for more details on the pattern options.- Type:
Object - Default:
{}
- Type:
patternOptions.all: This options is added topatternOptions, and determines whether all patterns need to match instead of only one.- Type:
Boolean - Default:
false
- Type:
The
cssandjsoptions will also be given to thehtml-minifierto use for CSS and JS content within HTML files.
Examples
CLI
{
"modules": {
"read": {},
"hoast-minify": {}
}
}Script
const Hoast = require(`hoast`);
const read = Hoast.read,
minify = require(`hoast-minify`);
Hoast(__dirname)
.use(read())
.use(minify())
.process();