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

revver

v0.0.2

Published

Asset versioning for Gulp by appending a content hash to filenames. Similar to `gulp-rev`.

Downloads

3

Readme

revver npm Version Build Status Coverage Status

Asset versioning for Gulp by appending a content hash to filenames. Similar to gulp-rev.

  • In-memory manifest that persists across Gulp tasks, with support for writing the manifest to disk if needed.
  • Built-in support for interpolating revved paths into file contents. Specify a custom interpolate regex, or specify a callback if you need to modify the revved path (eg. to add a prefix).

Example

'use strict';

var gulp = require('gulp');
var Revver = require('revver');
var revver = new Revver();

gulp.task('default', ['js'], function() {
  return gulp.src('index.html')
    .pipe(revver.interpolate())
    .pipe(revver.manifest({ clean: false }))
    .pipe(gulp.dest('build'));
});

gulp.task('js', function() {
  return gulp.src('script.js')
    .pipe(revver.rev())
    .pipe(gulp.dest('build'));
});

Run the example, or read the tests.

API

var Revver = require('revver');

var revver = new Revver([opts]);

Initialise the revver. opts takes the following keys:

  • manifest — An object literal that maps the original file paths to the revved file paths. Defaults to {}.
  • interpolateRegex — The regular expression used by the interpolate method. Defaults to /{{\s*([^}]+?)\s*}}/g.
  • interpolateCallback — A callback with the signature (revvedPath) for modifying the interpolated value in the interpolate method. Defaults to the identity function.

revver.rev()

Returns a through stream. Computes a hash of each file’s contents and appends said hash to the file’s basename. For example, an initial file.path of bundle.js might become bundle-d41d8cd98f.js.

revver.manifest([opts])

Returns a through stream. Discards all files piped into the stream, before pushing the manifest JSON file into the stream. opts takes the following keys:

  • filename — The name of the manifest file. Defaults to manifest.json.
  • clean — Set to false to pass all files through the stream rather than dropping them. Defaults to true.

revver.interpolate([opts])

Returns a through stream. Interpolate revved paths into the file.contents of files piped into the stream. Pass in opts.interpolateRegex or opts.interpolateCallback to override what had been set in the constructor.

revver.getHashes([opts])

Returns an object literal that maps the original file paths (without the file extensions) to their hashes. If opts.prefix is specified:

  • Only original file paths starting with the prefix will be included in the returned result.
  • The prefix will be trimmed off the original file paths in the result.

Installation

Install via npm:

$ npm i --save-dev revver

License

MIT