Skip to content

Commit

Permalink
allow ignored paths to be passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
w33ble committed Apr 20, 2014
1 parent 1b01c6b commit 8beed14
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions bin/lute.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ var isInt = require('../lib/util/isInt');
var serve = require('../lib/serve');
var port = (argv.p && isInt(argv.p)) ? argv.p : 8080;

// if a port or no args, start server
serve(port, (argv._.indexOf('open') !== -1));
serve(port, (argv._.indexOf('open') !== -1), argv);
4 changes: 2 additions & 2 deletions lib/serve/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ var createLiveReload = require('./createLiveReload');
var createServer = require('./createServer');
var watch = require('./watch');

module.exports = function(port, open) {
module.exports = function(port, open, argv) {

createLiveReload(function(err, liveReload, lrPort){
createServer(port, lrPort, open, function(err, server){
watch(liveReload);
watch(liveReload, argv);
});
});

Expand Down
10 changes: 8 additions & 2 deletions lib/serve/watch.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
var gulp = require('gulp');
var gutil = require('gulp-util');

module.exports = function(liveReload) {
module.exports = function(liveReload, argv) {

gulp.watch(["./**/*", "!./node_modules/**/*", "!./bower_components/**/*"], function(evt){
var paths = ["./**/*", "!./node_modules/**/*"];
var ignorePaths = (argv.i) ? argv.i.split(',') : [];
for(var i=0; i<ignorePaths.length; i++) {
paths.push("!./" + ignorePaths[i] + '/**/*');
}

gulp.watch(paths, function(evt){

gutil.log(gutil.colors.cyan(evt.path), 'changed');

Expand Down

0 comments on commit 8beed14

Please sign in to comment.