1

Can we provide the path for angular-cli.json to ng build, right now it doesn't seem to be supported.

Update:

What i am looking for is if we can have multiple angular-cli.json file with different name and that can be fed to ng build command something like

ng build --path\--config angular-cli-123.json 

enter image description here

Madhu Ranjan
  • 17,334
  • 7
  • 60
  • 69

3 Answers3

1

Multiple apps are now supported out of the box.

Angular CLI support multiple applications within one project. You use the apps array in .angular-cli.json to list files and folders you want to use for different apps.

"apps": [
  {
    "root": "src",
    ...
    "main": "main.ts",
    "polyfills": "polyfills.ts",
    "test": "test.ts",
    "tsconfig": "tsconfig.app.json",
    "testTsconfig": "tsconfig.spec.json",
    "prefix": "app",
    ...
  },
  {
    "root": "src",
    ...
    "main": "main2.ts",
    "polyfills": "polyfills2.ts",
    "test": "test2.ts",
    "tsconfig": "tsconfig.app.json",
    "testTsconfig": "tsconfig.spec.json",
    "prefix": "app2",
    ...
  }  
]

To serve the first app: ng serve --app=0 or ng serve --app 0

To serve the second app: ng serve --app=1 or ng serve --app 1

Hope it helps, someone!!

Madhu Ranjan
  • 17,334
  • 7
  • 60
  • 69
0

This answer might help.

Create a file called .ember-cli in your project, and include in it these contents:

{ "output-path": "./location/to/your/dist/" }

Community
  • 1
  • 1
itamar
  • 3,837
  • 5
  • 35
  • 60
0

You cannot pass an angular-cli.json file to ng build, but you can pass --output-path.

I'd store multiple npm scripts in my package.json file like:

"scripts": {
  ...
  "build:123": "ng build --output-path \"dist-123\"",
  "build:456": "ng build --output-path \"dist-456\"",
}
Meligy
  • 35,654
  • 11
  • 85
  • 109
  • 1
    The reason i need multiple `angular-cli.json` is, I have multiple apps with different configuration like src location of test scripts etc, I want to build them based upon there configuration. i can use --output-path for different output location, but the need is to build multiple apps using differnt src folders. Thanks! – Madhu Ranjan Feb 02 '17 at 20:07
  • I'd just use multiple Angular CLI projects for these to be honest. – Meligy Feb 02 '17 at 20:09