# hash-collection-plugin

> hash collection plugin with webpack like api.

Latest version **0.0.5** (published 2018-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install hash-collection-plugin
pnpm add hash-collection-plugin
yarn add hash-collection-plugin
bun add hash-collection-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2018-08-25 |
| First published | 2018-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | zon |
| Maintainers | zhiqiangzhong |
| Keywords | hash, collection, plugin, webpack |

## Links

- npm: https://www.npmjs.com/package/hash-collection-plugin
- Repository: https://github.com/zz1211/hash-collection-plugin
- Homepage: https://github.com/zz1211/hash-collection-plugin#readme
- Issues: https://github.com/zz1211/hash-collection-plugin/issues
- npm.io page: https://npm.io/package/hash-collection-plugin

## Dependencies (1)

- [fs-extra](https://npm.io/package/fs-extra.md) ^7.0.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2018-08-25
- 0.0.4 — 2018-08-24
- 0.0.3 — 2018-08-24
- 0.0.2 — 2018-08-24
- 0.0.1 — 2018-08-24

## README

# hash-collection-plugin

A hash #⃣️  collection plugin with webpack like api.

## Usage

hash-collection-plugin should be placed after hash generate plugin, then it will generate hash version file of javascript and css according to options or default options.

### jsdoc

```javascript
/**
 * Hash collection plugin.
 * @param {Object} options plugin options.
 * @param {String} [outputPath=''./server/config''] output path of generated version file.
 * @param {String} [options.separator='_'] separator to split key from hashed resource name.
 * @param {Boolean} [options.isMerge=false] flag that mark whether js hash and css hash should be merged together.
 * @param {String} [options.filename='version'] filename of exported version file with prefix css_ and js_.
 * @param {String} [options.extension='json'] extension of exported version file.
 * @param {Function} [options.processor=json-like processor] processor function used to process exported file before it is written to destination folder.
 * @param {String} [options.prefix=''] prefix of each key of hash chunk.
 */
```

### Example

#### Json-like version config

Code Snippet:

```javascript
new HashCollectionPlugin()
```

Output:

```
// css_version.json
{
  "css/main": "build/css/main_47d448e638e7a8599b08.css",
  "css/login": "build/css/login_4637dac3d936a233aa8b.css"
}

// js_version.json

{
  "js/main": "build/js/main_210fdd3c648cd70c0c2a.js",
  "js/login": "build/js/login_ba156756af82b3268698.js"
}
```

#### Java-like version config

Code Snippet:

```javascript
new HashCollectionPlugin({
  outputPath: '../is-join/is-join-config/src/main/resources',
  isMerge: true,
  filename: 'version',
  extension: 'properties',
  processor: function(data) {
    return Object.keys(data).map(key => `${key.replace(/\//g, '.')}=${data[key]}\n`).join('');
  }
})
```

Ouput:

```
// version.properties
css.main=build/css/main_47d448e638e7a8599b08.css
css.login=build/css/login_4637dac3d936a233aa8b.css
js.main=build/js/main_210fdd3c648cd70c0c2a.js
js.login=build/js/login_ba156756af82b3268698.js
```

TBD

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