A Brunch plugin which hashes and renames generated files and generates a digest.
The hashing works incremental and looks at the file-names in public/assets so it works best if there are no other files sitting there.
-
deletes files in public/assets that aren't in the src-asset folder or .css, .js, or .map
-
generates hash and renames files (incremental,
brunch watchcompatible) -
calculates image-sizes (useful for setting image-dimensions which increases PageSpeed)
-
renames assets referenced in
css-urlsto their new name -
renames sourcemaps (this will be probably removed)
-
write file-mapping and image-sizes to
../asset-manifest.json"img/btn_reset.png": { "url": "img/btn_reset-cd43a189.png", "imgSize": [67, 22] } ...
-
Breaks css auto-reload (will fix that)
-
Manifest-location not configurable
-
The incremental hashing algorithm won't delete files that match a filename in
app/assetswith a fingerprint on them.Example: If there's a file
btn.pngin src and there arebtn-x123456.pngandbtn-x78930-pngin output, those files won't be deleted. -
The hashing algorithm could get confused about files with a different fingerprint-format on them.
npm install hash-brunch --save-dev
exports.config =
# ...
plugins:
hashbrunch:
# Src-Asset folder
assetFolder: "app/assets"LGPL-2.1