Skip to content

Feature req: Environment specific assets/ angular-cli files #4150

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

Closed
mmc41 opened this issue Jan 21, 2017 · 12 comments
Closed

Feature req: Environment specific assets/ angular-cli files #4150

mmc41 opened this issue Jan 21, 2017 · 12 comments
Assignees

Comments

@mmc41
Copy link

mmc41 commented Jan 21, 2017

Currently, one can add asset folders by adding them to angular-cli.json's assets key. These assets will always be added regardless of environment.

I need to add test assets (stub-data) for test/development environments only - they should not be added to production. Hence I would like, angular-cli to support specifying different sets of asset folders depending on the build environment.

Another more general option, would be for angular-cli to support multiple angular-cli*.json files (additional files with environment specific overrides).

@mmc41 mmc41 changed the title Feature req: Environment specific assets Feature req: Environment specific assets/ angular-cli files Jan 21, 2017
@filipesilva
Copy link
Contributor

I know some users are adding stubs via the environment files (see #3940) but I understand your request is different.

I'll tag it for discussion but don't have any plans to add it for now.

@mmc41
Copy link
Author

mmc41 commented Jan 21, 2017

Thanks for the link. Yes, my case is different. I need to add different json files (and other resource files) depending on the environment.

@mmc41
Copy link
Author

mmc41 commented Jan 22, 2017

@filipesilva Just found out that the "apps" option in angular-cli.json is really an array although it seems only first element is currently supported. If angular was changed to fully support multiple elements in the configuration "apps" array than my use case (and many, many other use-cases) would be solved!

@alexciesielski
Copy link

+1, need to load different images for different environments

@richardelloyd
Copy link

+1, We're going through the same problem, right now. Environment based assets would be beneficial.

@filipesilva filipesilva self-assigned this May 22, 2017
@filipesilva
Copy link
Contributor

Heya @mmc41, you can now use the apps array as documented here: https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/multiple-apps.md

@KashMoneyMillionaire
Copy link

I believe this has moved here now: https://github.com/angular/angular-cli/wiki/stories-multiple-apps

@MickL
Copy link

MickL commented Jun 12, 2018

@filipesilva The story is also missing in the stories directory:
https://github.com/angular/angular-cli/wiki/stories

@takahser
Copy link

takahser commented Jul 5, 2019

Is this feature still available in Angular 8?

Currently, I have several directories:

  • src/assets/images/customer1
  • src/assets/images/customer2
  • src/assets/images/customer3

After the build, the folder of the configured customer should be available 1 directory level higher.
E.g. when running ng serve --app=customer1 all files in src/assets/images/customer1 should be available in src/assets/images. None of the other customer's assets should be available there.

(I've taken a look at the links above, but they either refer to the old angular-cli.json file or didn't contain any helpful information to solve my problem)

@MickL
Copy link

MickL commented Jul 5, 2019

@takahser Instead you could have:

  • assets/ (shared assets)
  • assets/customer1/
  • assets/customer2/
  • assets/customer3/

And then you can add it to the build of each customer:

"assets": [
                "src/assets",
                {
                  "glob": "**/*",
                  "input": "src/assets/customer1",
                  "output": "/assets"
                }
],

@takahser
Copy link

takahser commented Jul 8, 2019

@MickL thanks, that worked 👍🏼

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants