1.0.12 • Public • Published


    Fingerprint output files and update references


    yarn add makestatic-fingerprint



    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.

    See Also


    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.

    • context Object the processing context.
    • options Object the plugin options.
    • rules Array list of resource matching rules.
    • algorithm String=sha512 checksum algorithm.
    • id Function generate fingerprint id.
    • name Function generate new resource file name.
    • Error if no resource graph is available.


    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.

    • file Object the current file.
    • context Object the processing context.
    • Error if a resource could not be found in the graph.



    Created by mkdoc on March 12, 2017


    npm i makestatic-fingerprint

    DownloadsWeekly Downloads






    Last publish


    • tmpfs