x) "apps": [
{
"root": "src",
"outDir": "../mem-webman/src/main/webapp/dist",
"assets": [
"assets" // I want to ignore .svn in this folder
],
"index": "index.html",
"main": "main.ts",
angular-cli: 1.0.0-beta.26
node: 7.0.0
os: darwin x64
It looks like the dot files aren't ignored because of this configuration https://github.com/angular/angular-cli/blob/d94040b2de8165d97a218953ff0b2f98d4025cee/packages/%40angular/cli/models/webpack-configs/common.ts#L58 .
However, assets config accepts glob configs as stated here https://github.com/angular/angular-cli/wiki/stories-asset-configuration so you could try to write specific globs.
It would be great if we could simply add more items into the ignore array in the config.
Have you tried something like:
"assets": [
{ "glob": "**/*(!.svn)", "input": "./assets/", "output": "./assets/" }
]
It's a bit of a random shot based on https://github.com/isaacs/node-glob
Thinks very much, but such configuration don't work, it throw exception when ng build.
ENOENT: no such file or directory, stat '/Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/src/[object Object]'
Error: ENOENT: no such file or directory, stat '/Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/src/[object Object]'
at Object.fs.statSync (fs.js:898:18)
at /Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/node_modules/angular-cli/plugins/glob-copy-webpack-plugin.js:16:64
at Array.map (native)
at GlobCopyWebpackPlugin.apply (/Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/node_modules/angular-cli/plugins/glob-copy-webpack-plugin.js:16:29)
at Compiler.apply (/Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/node_modules/tapable/lib/Tapable.js:306:16)
at webpack (/Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/node_modules/webpack/lib/webpack.js:32:19)
at Class.run (/Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/node_modules/angular-cli/tasks/build-webpack.js:19:31)
at Class.buildRun (/Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/node_modules/angular-cli/commands/build.run.js:39:22)
at Class.run (/Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/node_modules/angular-cli/commands/build.js:38:47)
at Class.<anonymous> (/Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/node_modules/angular-cli/ember-cli/lib/models/command.js:147:17)
at process._tickCallback (internal/process/next_tick.js:103:7)
throw error at line 16: 64 in node_modules/angular-cli/plugins/glob-copy-webpack-plugin.js
...
// convert dir patterns to globs
patterns = patterns.map(function (pattern) { return fs.statSync(path.resolve(context, pattern)).isDirectory()
? pattern += '/**/*'
: pattern; });
// force nodir option, since we can't add dirs to assets
globOptions.nodir = true;
compiler.plugin('emit', function (compilation, cb) {
...
...
The argument pattern of callback function is not path string when using { "glob": "*/(!.svn)", "input": "./assets/", "output": "./assets/" }, so this line throw an exception 'ENOENT: no such file or directory, stat '/Users/chunhua/HBuilder/userprofiles/common-ng2/front-client/src/[object Object]'
angular-cli version is 1.0.0-beta.26
The solution provided by @Meligy should work, but only on recent CLI versions. You're using an old one that I do not think supports advanced assets configuration.
See https://github.com/angular/angular-cli/wiki/stories-rc-update on how to upgrade your project.
If after upgrading you still have the issue then we might need a new configuration item to add ignore patters to the glob.
Closing as inactive.
Negative globs as suggested by @Meligy have been removed in node-glob v6 (deprecated in v5). One should use the "ignore" option to the glob() call instead. Unfortunately I don't see how to do this from .angular-cli.json.
Negative glob still works for me:
"assets": [
"favicon.ico",
{ "glob": "**/!(test-*)", "input": "./assets/", "output": "./assets/" }
],
Here I'm excluding all "test-*" files from "assets" folder. Note: glob replaces original "assets" entry.
How i can copy only the files from a folder without the folders inside it?
i use ng-cli 6.1.4
I want copy only the JS files inside the Folder2, but without the "Folder2"
--> Folder2
------> *.js
i try this
{"glob": "**/*.js", "input": "workbox/", "output": "/workbox/"}
and this
{"glob": "**/**/*.js", "input": "workbox/", "output": "/workbox/"}
both not working
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Have you tried something like:
It's a bit of a random shot based on https://github.com/isaacs/node-glob