diff --git a/lib/consign.js b/lib/consign.js index eb6b874..b3311f6 100644 --- a/lib/consign.js +++ b/lib/consign.js @@ -30,7 +30,8 @@ function Consign(options) { logger: console, verbose: true, extensions: [], - loggingType: 'info' + loggingType: 'info', + ignore: false }; this._files = []; @@ -106,6 +107,15 @@ Consign.prototype._setLocations = function(parent, entity, push) { this._log(['!', this._['Ignoring extension'], ':', extension]); return this; } + + var ignoreRegex = new RegExp(this._options.ignore + '.*(' + this._options.extensions.join('|') +')', 'gi') + , filename = path.basename(location) + ; + + if (this._options.ignore && ignoreRegex.test(filename)) { + this._log(['!', this._['Ignoring file'], ':', filename]); + return this; + } if (push && this._files.indexOf(location) === -1) { this._files.push(location);