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

expose srcDirname to process function #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Default: `8`

The number of characters of the file hash to prefix the file name with.

#### options.process(basename, name, extension)
#### options.process(basename, name, extension, srcDirname)

Type: `function`
Default: `null`
Expand Down
4 changes: 2 additions & 2 deletions tasks/filerev.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = function (grunt) {
var stat = fs.lstatSync(el.dest);

if (stat && !stat.isDirectory()) {
grunt.fail.fatal('Destination ' + el.dest + ' for target ' + target + ' is not a directory');
grunt.fail.fatal('Destination ' + el.dest + ' for target ' + target + ' is not a directory');
}
} catch (err) {
grunt.verbose.writeln('Destination dir ' + el.dest + ' does not exists for target ' + target + ': creating');
Expand All @@ -51,7 +51,7 @@ module.exports = function (grunt) {
var newName;

if (typeof options.process === 'function') {
newName = options.process(path.basename(file, ext), suffix, ext.slice(1));
newName = options.process(path.basename(file, ext), suffix, ext.slice(1), path.dirname(file));
} else {
if (options.process) {
grunt.log.error('options.process must be a function; ignoring');
Expand Down