# hoast-minify

> Hoast module used to minify CSS, HTML, and JS files.

Latest version **1.2.1** (published 2019-03-13) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install hoast-minify
pnpm add hoast-minify
yarn add hoast-minify
bun add hoast-minify
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2019-03-13 |
| First published | 2018-10-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=7.8.0 |
| Dependencies | 3 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ron Dekker |
| Maintainers | redkenrok |
| Keywords | hoast, minify, css, html, js |

## Links

- npm: https://www.npmjs.com/package/hoast-minify
- Repository: https://github.com/hoast/hoast-minify
- Homepage: https://github.com/hoast/hoast-minify#readme
- Issues: https://github.com/hoast/hoast-minify/issues
- npm.io page: https://npm.io/package/hoast-minify

## Dependencies (3)

- [terser](https://npm.io/package/terser.md) ^3.17.0
- [clean-css](https://npm.io/package/clean-css.md) ^4.2.1
- [html-minifier](https://npm.io/package/html-minifier.md) ^3.5.21

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.2.1 (latest) — 2019-03-13
- 1.2.0 (next) — 2018-12-16
- 1.1.1 — 2018-10-24
- 1.1.0 — 2018-10-18
- 1.0.0 — 2018-10-11

## README

<div align="center">
  
  [![npm package @latest](https://img.shields.io/npm/v/hoast-minify.svg?label=npm@latest&style=flat-square&maxAge=3600)](https://npmjs.com/package/hoast-minify)
  [![npm package @next](https://img.shields.io/npm/v/hoast-minify/next.svg?label=npm@next&style=flat-square&maxAge=3600)](https://npmjs.com/package/hoast-minify/v/next)
  
  [![Travis-ci status](https://img.shields.io/travis-ci/com/hoast/hoast-minify.svg?branch=master&label=test%20status&style=flat-square&maxAge=3600)](https://travis-ci.com/hoast/hoast-minify)
  [![CodeCov coverage](https://img.shields.io/codecov/c/github/hoast/hoast-minify/master.svg?label=test%20coverage&style=flat-square&maxAge=3600)](https://codecov.io/gh/hoast/hoast-minify)
  
  [![License agreement](https://img.shields.io/github/license/hoast/hoast-minify.svg?style=flat-square&maxAge=86400)](https://github.com/hoast/hoast-minify/blob/master/LICENSE)
  [![Open issues on GitHub](https://img.shields.io/github/issues/hoast/hoast-minify.svg?style=flat-square&maxAge=86400)](https://github.com/hoast/hoast-minify/issues)
  
</div>

# hoast-minify

Minify CSS, HTML, and JS files using `clean-css`, `html-minifier`, and `terser` respectively.

> As the name suggest this is a [hoast](https://github.com/hoast/hoast#readme) module.

## Usage

Install [hoast-minify](https://npmjs.com/package/hoast-minify) using [npm](https://npmjs.com).

```
$ npm install --save hoast-minify
```

### Parameters

* `css`: Options for [`clean-css`](https://github.com/jakubpawlowicz/clean-css#constructor-options).
  * Type: `Object`
	* Default: `{}`
* `html`: Options for [`html-minifier`](https://github.com/kangax/html-minifier#options-quick-reference).
  * Type: `Object`
	* Default: `{ collapseWhitespace: true, removeComments: true }`
* `js`: Options for [`terser`](https://github.com/terser-js/terser#minify-options).
  * 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](https://github.com/redkenrok/node-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**

```json
{
  "modules": {
    "read": {},
    "hoast-minify": {}
  }
}
```

**Script**

```javascript
const Hoast = require(`hoast`);
const read = Hoast.read,
      minify = require(`hoast-minify`);

Hoast(__dirname)
  .use(read())
  .use(minify())
  .process();
```

---
_Source: https://npm.io/package/hoast-minify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
