gulp-md5-version

gulp-md5-version

Usage no npm install needed!

<script type="module">
  import gulpMd5Version from 'https://cdn.skypack.dev/gulp-md5-version';
</script>

README

gulp-md5-version

md5 plugin for gulp ,md5 the static files and then create a versonMapping file.

Usage

First, install gulp-md5-version as a development dependency:

npm install --save-dev gulp-md5-version

Then, add it to your gulpfile.js:

var md5 = require("gulp-md5-version");

gulp.src("./src/*.css")
    .pipe(md5())
    .pipe(gulp.dest("./prd"));

will create a versions.mapping

API

md5(config)

config.hashLength

Type: String
Default: 32

Optionnal: you can pass the size to limit the size of the hash that is appended.

config.pattern

Type: String
Default: @

Optionnal: Hash connector

config.versionName

Type: String
Default: versions.mapping

Optionnal: version file name

config.versionPath

Type: String
Default: prd/

Optionnal: version root path

Example:

    gulp.src('src/**/*.js')
        .pipe(md5({
            hashLength: 16,
            versionName: '.ver'
        })
        .pipe(gulp.dest('./prd'));

The sample above will append the md5 hash to each of the file in the src/ folder then create a .ver file in the /prd with all versionMapping;

License

http://en.wikipedia.org/wiki/MIT_License[MIT License]