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

gulp-cachebust

v0.0.11

Published

Generates checksums and renames references to files, useful for cachebusting

Downloads

5,642

Readme

gulp-cachebust

Generates checksums and renames references to files

Travis build status Dependency status MIT Licence

Useful for cachebusting

This plugin is only compatible with files that contain a stream, it only works in buffer mode.

This is the new repository for gulp-cachebust plugin. The plugin was originaly created by Josiah Truasheim and it has been transfered to this new repository (link to the previous one). Development will continue in this repository.

Install

Install with npm

npm install --save-dev gulp-cachebust

Example

var gulp = require('gulp');
var CacheBuster = require('gulp-cachebust');

var cachebust = new CacheBuster();

gulp.task('build-css', function () {
    return gulp.src('styles/*.css')
        // Awesome css stuff
        .pipe(cachebust.resources())
        .pipe(gulp.dest('dist/css'));
});

gulp.task('build-html', ['build-css'], function () {
    return gulp.src('templates/*')
        // Awesome html stuff
        .pipe(cachebust.references())
        .pipe(gulp.dest('dist'));
});

API

new CacheBuster(options)

options.checksumLength

Optional

Type: Number Default: 8

options.random

Generates the checksum based on a random sha1 hash and not on the file contents.
Useful for changing the file names on each deploy regardless if the content was changed or not.

Optional

Type: Boolean Default: false

options.pathFormatter

Specify a custom formatting function for busted paths. The default will output filenames like /path/to/basename.[hash].ext.

Optional

Type: Function Default: null

An example for outputing a custom hash prefix:

{
    pathFormatter: function(dirname, basename, extname, checksum) {
        return require('path').join(dirname, basename + '._v' + checksum + extname);
    }
}

CacheBuster.resources()

Renames and collects resources according to their MD5 checksum.

CacheBuster.references()

Rewrites references to resources which have been renamed according to their MD5 checksum.

License

MIT © Josiah Truasheim