Skip to content

Commit

Permalink
Allow using regex in exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Bonetti committed Jan 25, 2017
1 parent 1e77c65 commit cd367c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
root: '/full/project/path',
verbose: true,
dry: false,
exclude: ['shared.js']
exclude: ['shared.js', /style_.+\.css/]
})
]
}
Expand Down
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ CleanWebpackPlugin.prototype.apply = function () {
if (pathStat.isDirectory()) {
childrenAfterExcluding = fs.readdirSync(rimrafPath)
.filter(function (childFile) {
var include = _this.options.exclude.indexOf(childFile) < 0;
var include = true;

_this.options.exclude.forEach(function(exclusionRule) {
if (childFile.match(exclusionRule)) {
include = false;
}
});

if (!include) {
excludedChildren.push(childFile);
}
Expand Down

0 comments on commit cd367c1

Please sign in to comment.