A fork of metalsmith-fingerprint that discards the original file
This plugin fingerprints your files for easy and reliable cache-busting. Since you're not going to use the original, this fork discards it by default (but still allows you to keep it if you want to).
This plugin normalizes paths on windows using slash so that in most cases builds will work on both windows and *nix without any changes to the paths. Check the docs for slash for more details.
npm install metalsmith-fingerprint-ignore
Say you want to fingerprint the file
The plugin does three things:
- create a duplicate of
index.csswith a fingerprinted filename
- create a
fingerprintobject on the Metalsmith metadata
- Discard the original
fingerprint object is accessible from the Handlebars template:
And the template renders the fingerprinted filename:
- pattern: a pattern to filter source files (required)
- keep: keep source file, false by default (optional)
String|Array<String>: A pattern to filter source files. The path is relative to your
Boolean: Keep the original file. Setting it to true will keep the original file and create a fingerprinted version as well. Default
Metalsmith fingerprint does not discard the original file after fingerprinting. So when fingerprinting a large collection of files you'll have to manually ignore them all. Unfortunately the only predictable difference between the original and the fingerprinted file is the dash before the fingerprint.