# hash-static-files-brunch

> Fork @nerevu/cachebust-brunch. Rename assets based on SHA1 hash for cache busting with exclude files array and rename hashed files yet.

Latest version **1.3.1** (published 2021-10-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install hash-static-files-brunch
pnpm add hash-static-files-brunch
yarn add hash-static-files-brunch
bun add hash-static-files-brunch
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2021-10-05 |
| First published | 2021-09-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Gilles Maupoint |
| Maintainers | gillesmaupoint |
| Keywords | brunch, cache, hash, fingerprint |

## Links

- npm: https://www.npmjs.com/package/hash-static-files-brunch
- npm.io page: https://npm.io/package/hash-static-files-brunch

## Dependencies (2)

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

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.3.1 (latest) — 2021-10-05
- 1.3.0 — 2021-10-05
- 1.2.2 — 2021-10-05
- 1.2.0 — 2021-09-30
- 1.1.5 — 2021-09-30
- 1.1.4 — 2021-09-30
- 1.1.3 — 2021-09-30
- 1.1.2 — 2021-09-30
- 1.1.1 — 2021-09-28
- 1.1.0 — 2021-09-28
- 1.0.1 — 2021-09-28
- 1.0.0 — 2021-09-28

## README

# hash-static-files-brunch

The best of [fingerprinter-brunch](https://github.com/paulcsmith/fingerprinter-brunch), [hashfingerprint-brunch](https://github.com/jvanderneutstulen/hashfingerprint-brunch), and [timestamp-brunch](https://github.com/fabienL/timestamp-brunch). It's a fork of [cachebust-brunch] (https://github.com/nerevu/cachebust-brunch)

A [Brunch][] plugin that will rename assets with an unique SHA hash. This will allow better caching of assets. It will automatically rewrite the urls, and also write to a manifest file.

## Usage

`npm i hash-static-files-brunch`

_Note: make sure cachebust-brunch is listed *before* [gzip-brunch][]  in the dependency list of your package.json_

_Note: make sure cachebust-brunch is listed *after* [uglify-brunch][] in the dependency list of your package.json_

## Options

Default configuration:

```coffeescript
module.exports = config:
  plugins:
    cachebust:
      manifest: 'public/manifest.json'
      excludeFiles: []
      prefix: ''
      environments: ['production']
      reference: 'index.html'
      extensions: [
        /\.js$/
        /\.css$/
      ]
      precision: 8
      enabled: true
```

### manifest

Output location of the manifest file.

### excludeFiles

Array of files shouldn't be rewritten.

### prefix

Prefix added before hash.

### reference

The file where the urls should be rewritten. Array of files is possible.

### extensions

Array of extensions to match. Regex must be acceptable by `str.match`.
The array will be matched against the list of generated files.

### precision

The number of characters of the SHA1 hash to use in the hashed
filename. Default should be fine.

### enabled

Whether or not the plugin is enabled.

## Brunch build

```
brunch build
```

Script tags will compile as

```html
<script src="js/vendor.js"></script>
<script src="js/app.js"></script>
```

```
brunch build --production
```

Script tags will compile as

```html
<script src="js/vendor.24179978.js"></script>
<script src="js/app.24179978.js"></script>
```

## License

MIT

[Brunch]: http://brunch.io
[gzip-brunch]: https://github.com/banyan/gzip-brunch
[uglify-brunch]: https://github.com/brunch/uglify-js-brunch

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