Fingerprints output files.

Fingerprints output files for cache busting. Rewrites the references to the resources and renames the corresponding compilation assets.

Enable this plugin for the emit phase.

Fingerprinting uses a checksum of the file content to generate a unique name for the file, references to the resource are renamed and the corresponding output file is renamed.

Because this plugin is enabled during the emit phase you can be certain that the generated checksums match the actual checksums of the referenced files as the files have been optimized and sealed.

new Fingerprint(context, options)

Create a Fingerprint plugin.

The rules option is an array of regular expression resource patterns.

When no id function is specified the default implementation will generate a checksum of the resource file content. When no name function is given it generates a name prepending a period and the generated id before the file extension.

The signature for an id function is:

id(file, content)

It should return a unique identifier for the file.

The signature for a name function is:

name(file, id)

It should return the new name of the file based on the supplied id.

You may change the checksum algorithm using the algorithm option but it is recommended you use the default.

Fingerprint.prototype.sources(file, context)

Inspects the rules assigned to this plugin and finds matching resources.

For each matched resource call the id function to generate a unique identifier for the resource followed by the name function to generate a new name for the resource.

Once the resource name has been allocated references to the resource are renamed and compilation asset output paths are renamed.