npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

digest-brunch

v1.6.0

Published

A Brunch plugin that appends a unique SHA digest to asset filenames.

Downloads

234

Readme

Unsupported Project Status: Unsupported - The project has reached a stable, usable state but the author(s) have ceased all work on it.

I am no longer maintaining digest-brunch. I switched to Webpack for my front end applications. Contact me (@mutewinter) if you'd like to take over support for digest-brunch.

digest-brunch NPM Version Build Status Dependency Status

A Brunch plugin that appends a unique SHA digest to asset filenames. Allows for far-future caching of assets.

Note: digest-brunch is not compatible with gzip-brunch.

Usage

npm install --save digest-brunch

Identify assets that you want to be digested with DIGEST(filename.ext), or a custom pattern of your choosing.

<!DOCTYPE html>
<html lang="en">
<head>
  <script src="DIGEST(test.js)"></script>
  <link rel="stylesheet" href="DIGEST(test.css)">
</head>
<body>
  <script src="DIGEST(js/nested.js)"></script>
</body>
</html>

Run brunch build --production and you'll see something like the following:

Note: digest-brunch can not be run in watch mode. It's only intended for production builds, run once.

<!DOCTYPE html>
<html lang="en">
<head>
  <script src="test-75570c26.js"></script>
  <link rel="stylesheet" href="test-e3eda643.css">
</head>
<body>
  <script src="js/nested-4df52a0a.js"></script>
</body>
</html>

The asset files are also renamed, inside the public folder, to match the names above.

Options

Optional You can override digest-brunch's default options by updating your config.coffee with overrides.

These are the default settings:

exports.config =
  # ...
  plugins:
    digest:
      # A RegExp where the first subgroup matches the filename to be replaced
      pattern: /DIGEST\(\/?([^\)]*)\)/g
      # After replacing the filename, should we discard the non-filename parts of the pattern?
      discardNonFilenamePatternParts: yes
      # RegExp that matches files that contain DIGEST references.
      referenceFiles: /\.html$/
      # How many digits of the SHA1 to append to digested files.
      precision: 8
      # Force digest-brunch to run in all environments when true.
      alwaysRun: false
      # Specify an array of environments to run in.
      environments: ['production']
      # Prepend an asset host URL to the file paths in the reference files. Use an object e.g. {production: 'http://production-asset-host.co'}
      prependHost: null
      # Output filename for a JSON manifest of reference file paths and their digest.
      manifest: ''
      # An array of infixes for alternate versions of files. This is useful when e.g. using retina.js (http://imulus.github.io/retinajs/) (@2x) for high density images.
      infixes: []

Contributing

  1. Add some code
  2. Add some tests
  3. Run npm test
  4. Send a pull request

License

MIT