Wondering what’s next for npm?Check out our public roadmap! »

    hash-static
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    hash-static

    NPM Build Coverage

    Utility to hash static assets.

    hash-static provides a CLI to minify and hash static assets using htmlnano and posthtml-hash.

    Install

    yarn add -D hash-static

    Usage

    The entry must be an index.html file. The path is relative from the current directory.

    CLI

    yarn run hash-static 'dist/index.html'

    You can use the CLI as a postbuild script to package.json.

    "scripts": {
      "build": "rollup -c",
    + "postbuild": "hash-static dist/index.html"
    }

    Then, running yarn build will automatically run the postbuild script.

    Node

    const { hashStatic } = require('hash-static');
     
    hashStatic({ entry: 'dist/index.html' });

    Options

    Name Kind Description
    entry required string Relative path from the current directory to entry index.html
    minify optional boolean (default is true) Minify index.html markup

    Changelog

    License

    MIT

    Install

    npm i hash-static

    DownloadsWeekly Downloads

    5

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    10.3 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar