Skip to content

Commit

Permalink
Expose options.base for dest
Browse files Browse the repository at this point in the history
Because the stream returned from `dest` is also readable, it is kinda link a `src` to the next `dest` so the `base` should be configurable just like `src`.
  • Loading branch information
stevemao committed Jul 11, 2015
1 parent 435c401 commit f7516eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ This is just [glob-watcher].
- Possible options for the second argument:
- cwd - Specify the working directory the folder is relative to.
- Default is `process.cwd()`.
- base - Specify the folder relative to the cwd. This is used to determine the file names when saving in `.dest()`.
- Default is the `cwd` resolves to the folder path.
- mode - Specify the mode the files should be created with.
- Default is the mode of the input file (file.stat.mode) if any.
- Default is the process mode if the input file has no mode property.
Expand All @@ -112,6 +114,8 @@ This is just [glob-watcher].
- Possible options for the second argument:
- cwd - Specify the working directory the folder is relative to.
- Default is `process.cwd()`.
- base - Specify the folder relative to the cwd. This is used to determine the file names when saving in `.dest()`.
- Default is the `cwd` resolves to the folder path.
- dirMode - Specify the mode the directory should be created with.
- Default is the process mode.
- Returns a Readable/Writable stream.
Expand Down
2 changes: 1 addition & 1 deletion lib/prepareWrite.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function prepareWrite(outFolder, file, opt, cb) {
var outFolderPath = (
typeof outFolder === 'string' ? outFolder : outFolder(file)
);
var basePath = path.resolve(cwd, outFolderPath);
var basePath = options.base || path.resolve(cwd, outFolderPath);
var writePath = path.resolve(basePath, file.relative);
var writeFolder = path.dirname(writePath);

Expand Down

0 comments on commit f7516eb

Please sign in to comment.