Skip to content

Commit

Permalink
Merge pull request #85 from SparkartGroupInc/slow-windows-response-time
Browse files Browse the repository at this point in the history
Performance tweak: don't watch /deploy and /node_modules.
  • Loading branch information
Fauntleroy committed Feb 19, 2014
2 parents aba59c4 + 5b91a39 commit d16ac4a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,16 @@ var SolidusServer = function( options ){
var auth_regex = new RegExp( escapePathForRegex( paths.auth ), 'i' );

var watcher = this.watcher = chokidar.watch( paths.site, {
ignored: /^\./,
ignored: function( file_path ) {
// Ignore hidden files and directories
if( /[\/\\]\./.test( file_path ) ) return true;

// Ignore /deploy and /node_modules
var root = path.relative( paths.site, file_path ).split( /[\/\\]/ )[ 0 ];
if( root == 'deploy' || root == 'node_modules' ) return true;

return false;
},
ignoreInitial: true,
interval: 1000
});
Expand Down Expand Up @@ -289,7 +298,7 @@ var SolidusServer = function( options ){

server.close();
if( this.watcher ) this.watcher.close();

};

// use "this" as "this" for all methods attached to "this"
Expand Down

0 comments on commit d16ac4a

Please sign in to comment.