Permalink
Browse files

Allow for multiple basepaths, separated by a comma.

  • Loading branch information...
1 parent 205dbb5 commit 6ab6f3d8e047caa9c083cb9756d1cc3b4846c027 @slaskis slaskis committed May 30, 2012
Showing with 10 additions and 5 deletions.
  1. +2 −1 bin/browserbuild
  2. +8 −4 lib/browserbuild.js
View
@@ -3,14 +3,15 @@
var program = require('commander')
, pwd = process.cwd()
, browserbuild = require('../lib/browserbuild.js')
+ , list = function(v){return v.split(/ *, */)}
// program
program
.version(require('../package').version)
.usage('[options] <file …>')
.option('-g, --global [name]', 'Name of the global to export.')
- .option('-b, --basepath [name]', 'Base path of supplied files ['+ pwd + '].', pwd)
+ .option('-b, --basepath [paths]', 'List of base paths of supplied files ['+ pwd + '].', list, [pwd])
.option('-m, --main <name>', 'Name of the main file/module to export.')
.option('-d, --debug', 'Includes visionmedia/debug for a dev build.')
.parse(process.argv)
View
@@ -57,12 +57,16 @@ Renderer.prototype.render = function(done){
};
Renderer.prototype._render = function(filepath) {
- var base = this.options.basepath
+ var basepath = this.options.basepath
, source = fs.readFileSync(filepath, 'utf8')
- if (base && base == filepath.substr(0, base.length)) {
- filepath = filepath.substr(base.length);
- }
+ // match a basepath
+ basepath.some(function(base){
+ if (base == filepath.substr(0, base.length)) {
+ filepath = filepath.substr(base.length);
+ return true;
+ }
+ })
// remove `if node`
var ignoring = false

0 comments on commit 6ab6f3d

Please sign in to comment.