Skip to content

Commit

Permalink
Add asset.ignore option (#23)
Browse files Browse the repository at this point in the history
* Add `asset.ignore` option
* Add test for "ignore" option
  • Loading branch information
samuelmeuli authored and ifahrentholz committed Oct 30, 2019
1 parent bad53ba commit abda434
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ The following can be configured:
* `dest` {String} - destination relative to the clientlib folder including base
* `cwd` {String} - change working directory (relative to the context / global `cwd` option); only available with glob pattern
* `flatten` {Boolean} - using file's basename instead of folder hierarchy; default true; only available with glob pattern
* `ignore` `{String|Array<String>}` - glob pattern or array of glob patterns for matches to exclude

For an glob example see example section below.

Expand Down
3 changes: 3 additions & 0 deletions lib/clientlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ function normalizeAssets(clientLibPath, assets) {
if (asset.cwd) {
globOptions.cwd = asset.cwd;
}
if (asset.ignore) {
globOptions.ignore = asset.ignore;
}

asset.files.forEach(function (file) {
var fileItem = file;
Expand Down
11 changes: 11 additions & 0 deletions test/clientlib.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,17 @@ module.exports = {
"src/frontend/resources/template.html"
]
}
},
{
name: "test.base.apps.ignoreOption",
assets: {
js: {
cwd: "src/frontend/js",
flatten: false,
files: ["**/*"],
ignore: ["**/*.min.js", "**/*.min.js.map"]
}
}
}
]
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#base=js

app.js
libs/mylib.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

"use strict";
var Test = function() {
this.test = "test";
};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit abda434

Please sign in to comment.