0.0.3 • Published 9 years ago

hashfingerprint-brunch v0.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

hashfingerprint-brunch npm version

A Brunch plugin that will rename assets with an unique SHA hash. This will allow better caching of assets. It will write a manifest file, so other tooling can rewrite the urls.

Usage

npm install --save hashfingerprint-brunch

Note: if you're using gzip-brunch make sure hashfingerprint-brunch is listed before gzip-brunch in the dependency list of your package.json

By default hashfingerprint-brunch will process generated files with extension '.js' and '.css'.

Hugo integration

For Hugo to rewrite resource urls, use the following in your brunch config:

modules.exports = config:
  # ...
  plugins:
    hash:
      manifest: 'data/manifest.json'
  paths:
    public: 'static'
  # ...

Then in your Hugo templates use the following snippet:

<link rel="stylesheet" href="/{{ index $.Site.Data.manifest "css/mycss.css" }}" />

This will lookup the fingerprinted filename for 'css/mycss.css' from data/manifest.json'.

Options

License

MIT