-
Notifications
You must be signed in to change notification settings - Fork 12k
ng6 workspace: shared resources (styles, assets, scripts) should be merged with configuration specific ones #11149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't agree that arrays should be merged between configurations as a default. Replacement is a more powerful and intuitive model for how configurations should work. But I do agree that it would be nice to have a way to merge arrays. |
@filipesilva Being able to also use a module that exports the configuration object (e.g. |
bump (so that the issue does not become stale) |
Guys, could you take care of it.
And just run it Expected that the processed config is about
|
Another way, maybe
|
For file replacements this really needs to be a feature, so i can have different targets for production, staging, dev, and various whitelabels of products for strings and css and i8n deployments |
+1 for a way to merge fileReplacements please! I'm combining environmental build configs with various sub-brand configurations like changing the routing config, switching in a different brand stylesheet etc. In the future I will likely also want to stack on different locale builds but that may not require fileReplacements and would therefore already work.
|
I was thinking about a solution that goes like this:
|
Discussed this within the tooling team today and our take is that deeply merging objects automatically is simply too nuanced. It sounds like a straightforward change, but whether it makes sense for a particular value to be replaced, merged, or concatenated will vary based on the semantics of that field and what the common use cases for it are. Even if merging is commonly useful for a particular field, there will always be use cases that don't want the merging behavior, and opting out of it requires even more options. Always replacing the property may not always be desired, but it is at least consistent and easy to reason about. The easiest workaround here is to just copy-paste the data into multiple configurations. It is a bit redundant and not ideal but it is the simplest solution. For bundling JS and CSS, another approach is to make a single entry point for each configuration, and let that entry point import the files you actually want to use for that config. For the original example: /* app.css */
@import 'node_modules/a/a.css';
@import 'node_modules/b/b.css';
@import 'node_modules/c/c.css'; /* dev.css */
@import 'app.css';
@import 'node_modules/d/d.css'; // angular.json
{
// ...
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
// ...
"styles": ["app.css"]
},
"configurations": {
"development": {
// ...
"styles": ["dev.css"]
}
}
}
} We think these workarounds would not be significantly improved by defining complex semantics for merging multiple configurations. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Area
Versions
@angular/cli 6.0.3
node v8.9.4
yarn 1.6.0
Repro steps
Create
angular.json
with the following structure:Desired functionality
Shared styles at
build.options.styles
should be merged with configuration specific ones atbuild.configurations.<CFG>.styles
to avoid defining them again. The same applies forassets
andscripts
too.The text was updated successfully, but these errors were encountered: