diff --git a/Gruntfile.js b/Gruntfile.js index a9e2b22..163f66a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -46,7 +46,8 @@ module.exports = function(grunt) { custom_options: { options: { algorithm: 'sha1', - length: 4 + length: 4, + separator: '-' }, src: ['tmp/custom.txt'] }, diff --git a/tasks/rev.js b/tasks/rev.js index f6f77c2..352809d 100644 --- a/tasks/rev.js +++ b/tasks/rev.js @@ -26,7 +26,8 @@ module.exports = function(grunt) { var options = this.options({ encoding: 'utf8', algorithm: 'md5', - length: 8 + length: 8, + separator: '.' }); this.files.forEach(function(filePair) { @@ -34,7 +35,7 @@ module.exports = function(grunt) { var hash = md5(f, options.algorithm, 'hex', options.encoding), prefix = hash.slice(0, options.length), - renamed = [prefix, path.basename(f)].join('.'), + renamed = [prefix, path.basename(f)].join(options.separator), outPath = path.resolve(path.dirname(f), renamed); grunt.verbose.ok().ok(hash); diff --git a/test/rev_test.js b/test/rev_test.js index b876642..3c04953 100644 --- a/test/rev_test.js +++ b/test/rev_test.js @@ -38,7 +38,7 @@ exports.rev = { custom_options: function(test) { test.expect(1); - var exists = grunt.file.exists('tmp/2fd4.custom.txt'); + var exists = grunt.file.exists('tmp/2fd4-custom.txt'); test.ok(exists, '4 character SHA-1 hash prefix'); test.done();