My application caters to different customers, requiring personalized configurations based on their needs.
I am looking for a way to customize the settings in the angular-cli.json file each time I run ng build. Is there a method to:
1) Dynamically change the angular-cli.json file during build?
2) Pass a variable to modify the 'styles' and 'dist' fields?
Currently, I have to manually update the configuration for each client before building the app. I aim to automate this process by creating a script that can handle multiple builds consecutively, but customization seems impossible without being able to personalize angular-cli.json for each build.
UPDATE
I came across this link, but I'm unsure how to implement it. I checked the documentation here with no luck. Should I add a property under the app array in angular-cli.json? Or do I need to create another array similar to the one for apps?
UPDATE 2
This is what my configuration looks like under apps:
{
"name":"app1",
"root": "src",
"outDir": "dist",
"assets": [
"fonts",
"images",
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"paper.css",
"styles.css",
"style_app1.css"
],
"scripts": ["../node_modules/chart.js/dist/Chart.bundle.min.js"],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
},
{
"name":"app2",
"root": "src",
"outDir": "dist2",
"assets": [
"fonts",
"images",
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"paper.css",
"styles.css",
"style_app2.css"
],
"scripts": ["../node_modules/chart.js/dist/Chart.bundle.min.js"],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
It appears that when I run ng build --app app2, nothing gets generated in dist2. This approach does not seem to work as expected.