Socket
Book a DemoInstallSign in
Socket

gulp-hash

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-hash

A gulp plugin for cachebusting files by adding a hash to their name and/or content. Optionally writes a JSON file with mappings from the original filename to the renamed one.

Source
npmnpm
Version
2.0.3
Version published
Weekly downloads
2.2K
-58.92%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-hash

Gulp plugin for cachebusting files by adding a hash to their name and/or content. Optionally writes a JSON file with mappings from the original filename to the renamed one.

Basic usage

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

// ...

gulp.src('./js/**/*')
	.pipe(hash()) // Add hashes to the files' names
	.pipe(gulp.dest('public/js')) // Write the now-renamed files
	.pipe(hash.manifest('asset-hashes.json')) // Change the stream to the manifest file
	.pipe(gulp.dest('public')); // Write the manifest file

API

hash(options)

OptionDefaultDescription
algorithm'sha1'A hashing algorithm for crypto.createHash or equivalent custom function
hashLength8The length of the hash to add to the file's name (substr from the start of the full hash)
template'<%= name %>-<%= hash %><%= ext %>'Format for renaming the files

A more advanced example

See example/example-gulpfile.js for an example for a full gulpfile.

Keywords

cache

FAQs

Package last updated on 25 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts