Skip to content
This repository was archived by the owner on Mar 26, 2018. It is now read-only.

Commit cc995cb

Browse files
feat(basename): add option for output basename only
Conflicts: tasks/filerev.js
1 parent d2513c6 commit cc995cb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tasks/filerev.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module.exports = function (grunt) {
99
grunt.registerMultiTask('filerev', 'File revisioning based on content hashing', function () {
1010
var options = this.options({
1111
algorithm: 'md5',
12-
length: 8
12+
length: 8,
13+
basename: false
1314
});
1415
var target = this.target;
1516
var filerev = grunt.filerev || {summary: {}};
@@ -74,8 +75,13 @@ module.exports = function (grunt) {
7475
}
7576
}
7677

77-
filerev.summary[path.normalize(file)] = path.join(dirname, newName);
78-
grunt.verbose.writeln(chalk.green('✔ ') + file + chalk.gray(' changed to ') + newName);
78+
if (options.basename) {
79+
filerev.summary[path.basename(file)] = newName;
80+
} else {
81+
filerev.summary[path.normalize(file)] = path.join(dirname, newName);
82+
}
83+
grunt.log.writeln(chalk.green('✔ ') + file + chalk.gray(' changed to ') + newName);
84+
7985
if (sourceMap) {
8086
filerev.summary[path.normalize(file + '.map')] = path.join(dirname, newName + '.map');
8187
grunt.verbose.writeln(chalk.green('✔ ') + file + '.map' + chalk.gray(' changed to ') + newName + '.map');

0 commit comments

Comments
 (0)