Grunt task for Fingerprinting based on the file modified time / Nodejs Crypto md5 algorithm. This Grunt task can be used for assets versioning
Install grunt-kairekai
:
npm install grunt-kairekai --save-dev
grunt.initConfig({
kairekai: {
sourceOne: {
src: [
'assets/textfile-one*.js'
],
baseVal: "base64",
action:"createSrcCopy",
filename: 'a.txt'
},
sourceTwo: {
src: [
'assets/textfile-two.js'
],
algorithm: "timeStamp",
action:"createSrcCopy",
filename: 'a.txt'
},
sourceThree: {
src: [
'assets/textfile-three.js'
],
algorithm: "timeStamp",
action:"createSrcCopy",
filename: 'a.txt'
}
}
});
grunt.loadNpmTasks('grunt-kairekai');
-
algorithm(optional): Datatype string which decides algorithm to generate fingerprint value, "timeStamp" - fingerprint based on time modified,"md5" - node crypto md5 algorithm based output. default to "md5".
-
baseVal(optional): Datatype string which decides base value for out put fingerprinting value in "hex" or "base16", "base64". default value "hex" or "base16"
-
action(mandatory): Datatype string which decides whether to rename or create copy file along fingerprint value.
-
filename(mandatory): Datatype string, file path to replace the original file with fingerprint value.