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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gulp-revise

v2.0.0

Published

Opinionated, straight to the point assets revisioning.

Downloads

180

Readme

gulp-revise

Opinionated, straight to the point assets revisioning.

Mostly inspired by gulp-rev.

Example

dist/
    app.js.rev
    app_273c2cin3f.js
    app_273c2cin3f.js.map
    vendors.js.rev
    vendors_d41d8cd98f.js
    vendors_d41d8cd98f.js.map
src/
    app.js
    vendors.js
gulpfile.js

gulpfile.js

var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var revise = require('gulp-revise');

gulp.task('default', function () {
  return gulp
    .src('src/*.js')
    .pipe(sourcemaps.init())
    .pipe(uglify())
    .pipe(revise())
    .pipe(sourcemaps.write('.'))
    .pipe(revise.write())
    .pipe(gulp.dest('dist'))
  ;
});

app.js.rev

app_273c2cin3f.js

vendors.js.rev

vendors_d41d8cd98f.js

Documentation

revise()

Adds the _hash suffix to the files in the stream (hash being the md5 of the file's content).

revise.write()

For each files that have been revised, creates a .rev file that contains the file's name. e.g app.js is renamed to app_273c2cin3f.js so the app.js.rev contains app_273c2cin3f.js.

path

The path to look for existing .rev file so it can delete old revisions. Should be the same as the one passed to gulp.dest().

Note: also delete the corresponding .map files.

revise.merge(basePath = process.cwd())

Merge the .rev files in the stream to create a rev-manifest.json file, e.g:

var gulp = require('gulp');
var revise = require('gulp-revise');

gulp.task('merge', function () {
  return gulp
    .src('dist/*.rev')
    .pipe(revise.merge())
    .pipe(gulp.dest(''));
});

rev-manifest.json looks like this:

{
  "dist/app.js": "dist/app_273c2cin3f.js",
  "dist/vendors.js": "dist/vendors_d41d8cd98f"
}

By default, basePath is set to process.cwd() which assumes the current working directory to be the root. However, you can pass a custom base path, e.g:

var gulp = require('gulp');
var revise = require('gulp-revise');

gulp.task('merge', function () {
  return gulp
    .src('dist/*.rev')
    .pipe(revise.merge('dist'))
    .pipe(gulp.dest(''));
});

Will result in:

{
  "app.js": "app_273c2cin3f.js",
  "vendors.js": "vendors_d41d8cd98f"
}

revise.noop()

noop utility that just adds the required props to the files for .write() to work as usual. That way the .rev files are properly updated with the file's name, no hash added.

Example:

// var revise = require('gulp-revise');
if (isWatching) {
  stream = stream.pipe(revise.noop());
} else {
  stream = stream.pipe(revise());
}

Change Log

v2.0.0 - 2017-02-16

  • Add basePath option to .merge()
    • This is a breaking change: the path to the file was not added until now. If you still want to just have the file names, pass the base path as an argument to .merge().

v1.1.1 - 2016-12-03

  • fix write() to work with sub directories #3

v1.1.0 - 2016-12-01

  • ~~write() no more requires the dest path (also fixes #3)~~

Sadly, this version actually introduced a regression.

v1.0.0 - 2016-08-19

  • Remove restore()
  • Add noop() as a replacement for restore()

v0.0.6 - 2016-04-26

  • Add restore() to rename files after their .rev

v0.0.5 - 2016-04-16

  • Added checks to prevent facing unusual errors.

v0.0.4 - 2016-04-12

  • Fixed an issue regarding the generation of source maps.

v0.0.3 - 2016-04-05

  • Update documentation.

v0.0.2 - 2016-04-04

  • Update documentation and related links.

v0.0.1 - 2016-04-04

First release.