1.2.1 • Published 5 years ago

hoast-minify v1.2.1

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

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-minify

Parameters

  • css: Options for clean-css.
    • Type: Object * Default: {}
  • html: Options for html-minifier.
    • Type: Object * Default: { collapseWhitespace: true, removeComments: true }
  • js: Options for terser.
    • Type: Object * Default: {}
  • patternsCSS: Glob patterns to match file paths with that will be processed by clean-css.
    • Type: String or Array of strings Default: `[ '.css' ]`
  • patternsHTML: Glob patterns to match file paths with that will be processed by html-minifier.
    • Type: String or Array of strings Default: `[ '.html' ]`
  • patternsJS: Glob patterns to match file paths with that will be processed by terser.
    • Type: String or Array of strings Default: `[ '.js', '*.mjs' ]`
  • patternOptions: Options for the glob pattern matching. See planckmatch options for more details on the pattern options.
    • Type: Object
    • Default: {}
  • patternOptions.all: This options is added to patternOptions, and determines whether all patterns need to match instead of only one.
    • Type: Boolean
    • Default: false

The css and js options will also be given to the html-minifier to 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();
1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago