Skip to content

Support renaming of asset file #8808

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

Open
JaapMosselman opened this issue Dec 8, 2017 · 9 comments
Open

Support renaming of asset file #8808

JaapMosselman opened this issue Dec 8, 2017 · 9 comments
Labels
area: @angular-devkit/build-angular devkit/build-angular:browser feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Milestone

Comments

@JaapMosselman
Copy link

Feature request

It would be nice have an option to rename an asset in certain situations, e.g. when having conflicts in third party stuff.
Add property "filename" with the new file name.
Will only be used when the glob resolves to exactly one file.

"assets": [
  { "glob": "**/*", "input": "./assets/", "output": "./assets/" },
  { "glob": "favicon.ico", "input": "./", "output": "./", "filename": "newname.ico" },
]
@Brocco Brocco added the feature Issue that requests a new feature label Dec 8, 2017
@filipesilva filipesilva added the P5 The team acknowledges the request but does not plan to address it, it remains open for discussion label Jan 9, 2018
@gagle
Copy link

gagle commented May 18, 2018

Any news with Angular 6?

@bdbrown4
Copy link

Any updates here? https://github.com/webpack-contrib/copy-webpack-plugin already provides this solution.

@filipesilva filipesilva added area: @angular-devkit/build-angular and removed P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Oct 8, 2019
@ngbot ngbot bot added this to the Backlog milestone Oct 8, 2019
@IonelLupu
Copy link

One and a half years later, we still need this.
Example: I have a list o transactions that used different credit cards (visa, master card, paypal etc.) and I am using a library that provides SVGs for these cards. The problem is that the library named the no found credit card as default.svg but my backend (which I can't change) returns this type of card as not_found and not default.

I need this angular feature to renamed default.svg to not_found.svg

@FloNeu
Copy link

FloNeu commented Aug 28, 2020

@alan-agius4 Refering to Closed Ticket #16779. You mentioned file-replacement section in angular.json was only intended to work with files that are added to a bundle - and it working for regular-files was kind of an error. But why was this behaviour changed ( without so much as a mention or a deprication-warning ) as I am not aware this caused any problems... For me this caused major headaches and suddenly breaking my pwa-install features ( because I have manifest-files for different environments ) after updating from ng9 to ng10. Now I had to refector a whole punch of apps, because there is no replacement allowing the previous behaviour with current angular version. Can't this be reverted, deprecated and transparently reintroduced when this is implemented?

@alan-agius4
Copy link
Collaborator

Hi @FloNeu, the behaviour was changed in version Angular CLI version 9 during one of the RC's. In version 9 we introduced another layer in the build process to support downlevelling, parallel copying of assets and the new Ivy i18n. In this layer fileReplacements doesn't exists because at this point the bundles have been created, and source files which needed to be replaced have been.

While I understand that this might be an inconvenience for some. I don't think it's feasible to implement a feature to remove it in 2 major versions.

@FloNeu
Copy link

FloNeu commented Aug 30, 2020 via email

@Lonli-Lokli
Copy link

@FloNeu it was not officially supported and documented.

You can use workaround from some comment above

@bridzius
Copy link

bridzius commented Sep 1, 2021

This is a very useful feature for multi-environment and multi-locale support in large projects.
Are there are any thoughts about implementing it?

@Lonli-Lokli
Copy link

As for me the easiest and extendable approach will be support for bash scripts as part of build or publish

@angular-robot angular-robot bot added the feature: under consideration Feature request for which voting has completed and the request is now under consideration label Feb 1, 2022
@ngbot ngbot bot modified the milestones: Backlog, needsTriage Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: @angular-devkit/build-angular devkit/build-angular:browser feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests

10 participants