1.1.1 • Published 4 years ago

@mokahr/gulp-revision-hash v1.1.1

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

gulp-revision-hash

inspired by gulp-rev add content hash to asset filenames like: xxx.js => xxx_aobusk12soi3.js

install

$ npm install --save-dev gulp-revision-hash

usage

add content hash to filenames

const gulp = require('gulp');
const rev = require('gulp-revision-hash');

exports.default = () => (
	gulp.src('src/*.js')
		.pipe(rev())
    .pipe(gulp.dest('dist'))
    .pipe(rev.manifest('manifest.json'))
    .pipe(gulp.dest('dist'));
);

create a simple hash

const hash = rev.getCommonHash('any string');

API

rev(hash)

hash

Type: string

Default: radom hash

ref.manifest(path)

path

Type: string

Default: manifest.json

rev.getCommonHash(hashString)

hashString

Type: string

Default: Date.now()