browserify / watchify

watch mode for browserify builds
Other
1.79k stars 181 forks source link

Watch over a folder of all same type files #138

Closed allenanie closed 9 years ago

allenanie commented 9 years ago

I'm pretty new on Gulp, Watchify and browserify, so I borrowed this code from someone's blog:

function browserifyShare(){
  var b = browserify({
    cache: {},
    packageCache: {},
    fullPaths: true
  });

  if(watch) {
    // if watch is enable, wrap this bundle inside watchify
    b = watchify(b);
    b.on('update', function(){
      bundleShare(b);
    });
  }

  b.add('./views/js/lib/http.js');
  b.add('./views/js/lib/webSocket.js');

  b.add('./views/js/home.js');
  bundleShare(b);
}

The problem is that I have to use b.add() to watch over a new file. What if I have numerous files under the same directory and I want to watch over all of them? I tried js/lib/*.js but it didn't work.

allenanie commented 9 years ago

Sorry I posted on the wrong github repo....I just realized b.add() is a browserify problem not watchify.