Skip to content

Commit 43a8ebe

Browse files
committed
Added pattern-level ignore
1 parent 077e680 commit 43a8ebe

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ A pattern looks like:
4545
- defaults to `false`
4646
- removes all directory references and only copies file names
4747
- if files have the same name, the result is non-deterministic
48+
* `ignore`
49+
- additional globs to ignore for this pattern
4850

4951
#### Available options:
5052
* `ignore`

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default (patterns = [], options = {}) => {
4343
const outputPath = getOutputDir(compiler);
4444
const fileDependencies = [];
4545
const contextDependencies = [];
46-
const ignoreList = options.ignore;
46+
const webpackIgnore = options.ignore || [];
4747
const copyUnmodified = options.copyUnmodified;
4848
let writtenAssets;
4949
let lastGlobalUpdate;
@@ -57,6 +57,7 @@ export default (patterns = [], options = {}) => {
5757
let relDest;
5858
let globOpts;
5959
let context;
60+
const ignoreList = webpackIgnore.concat(pattern.ignore || []);
6061

6162
if (pattern.context && !path.isAbsolute(pattern.context)) {
6263
pattern.context = path.resolve(webpackContext, pattern.context);

tests/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,23 @@ describe('apply function', () => {
578578
.then(done)
579579
.catch(done);
580580
});
581+
582+
it('ignores files in pattern', (done) => {
583+
runEmit({
584+
expectedAssetKeys: [
585+
'directory/directoryfile.txt',
586+
'directory/nested/nestedfile.txt'
587+
],
588+
patterns: [{
589+
from: '**/*.txt',
590+
ignore: [
591+
'file.*'
592+
]
593+
}]
594+
})
595+
.then(done)
596+
.catch(done);
597+
});
581598
});
582599

583600
describe('with directory in from', () => {

0 commit comments

Comments
 (0)