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

grunt-rev-all

v0.1.2

Published

Rename all files with an MD5, update all links hierarchically.

Downloads

10

Readme

grunt-rev-all v0.1.2

Revision everything possible.

Details

Background

Files named according to their contents (MD5) can be cached forever. HTML links must be updated to match the new name in a hierarchy way: if an image changes, then the CSS referencing it is updated, and its MD5 changes so the main HTML reference is changed.

Why

Existing MD5-append revisioners are either difficult to configure or are "intelligent" about finding links while missing more obscure Javascript uses of references (Angular template references, JSON referring to images). This tool follows a 'heavy-hammer' approach and rewrites any string that appears to be a path to an existing file in the tree, whether root-based or (multiple-) parent-link (../) based.

Getting Started

This plugin requires Grunt ~0.4.0

You may install this plugin with this command:

npm install grunt-rev-all --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-rev-all');

Usage Examples

"grunt-rev-all": {
  // a grouping. Multiple is OK.
  buildAssets: {  

    // What files will be revisioned? (changed in-place)
    src: ["build/**/*"],

    // At HTTP time: Where is the root HTTP folder? 
    root: "build/",

    // Which files (by lower-cased extension) have links to other files? 
    // Ex: excluding images, including a static JSON (for JS to consume) that could have links.
    hasLinks: [".html", ".css", ".js", ".json"],

    // At HTTP time: Where does a file's search path begin? 
    // Ex: JS (in /lib) will path out from build/ (where its HTML is that loaded it).
    // Ex: Angular Views have links relative to the HTML that loads it (build/onboard)
    runtimeBase: {
      "build/": ["build/style/**/*", "build/views/**/*", "build/lib/**/*"],
      "build/onboard/": "build/onboard/views/**/*"
    },

    // also consider a local basepath (for JS's map files)
    lookLocal: ["build/lib/**/*"],

    // Paths linked-to directly or via server config (404.html, etc) should never be renamed.
    // This list should mirror the files that have 'no-cache' set.
    noRev: ["build/index.html", "build/signup.html", "build/login.html"]
  }
}

This task supports all the file mapping format Grunt supports (except in hasLinks). Please read Globbing patterns and Building the files object dynamically for additional details.

├── Gruntfile.js
└── build/
    ├── index.html
    ├── login.html
    └── lib
        ├── all.min.js
        └── all.min.map
....
Troubleshooting

The console output indicates general data about files found, links counted, and circular reference processing.

Release History

  • 2014-12-01   v0.1.0   Overhauled an internal tool removing the complex-fragile config process.

Task submitted by Andrew Jackson