hashfingerprint-brunch

0.0.3 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i hashfingerprint-brunch

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • jvanderneut