Skip to content
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

Expose postTransform to all builder APIs to allow index html manipulation #26299

Closed
muuvmuuv opened this issue Nov 9, 2023 · 4 comments · Fixed by #26667
Closed

Expose postTransform to all builder APIs to allow index html manipulation #26299

muuvmuuv opened this issue Nov 9, 2023 · 4 comments · Fixed by #26667
Labels
angular/build:application area: @angular-devkit/build-angular feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature

Comments

@muuvmuuv
Copy link

muuvmuuv commented Nov 9, 2023

Command

build, serve

Description

We are dynamically generating our index.html through just-jeb/angular-builders because we have preconnect's set based on env vars and other stuff that cannot be done through JS.

Now we want to move to the Angular 17 application builders. But we cannot modify the index.html there. We already tried programmatically but buildApplication does not expose the transform plugin option from IndexHtmlGenerator.

Describe the solution you'd like

The IndexHtmlGenerator already has an postTransformPlugin which only requires the option postTransform to be passed to it from the builders.

If we would pass this option to executePostBundleSteps and then to generateIndexHtml we can then modify the index.html.

Describe alternatives you've considered

An angular.json property to a file that exports a default function that is passed to postTransform

@muuvmuuv
Copy link
Author

muuvmuuv commented Nov 9, 2023

@[email protected]

Here is a patch file that works.

@angular-robot angular-robot bot added the feature: votes required Feature request which is currently still in the voting phase label Nov 10, 2023
Copy link
Contributor

angular-robot bot commented Nov 10, 2023

This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.

You can find more details about the feature request process in our documentation.

@arnabk
Copy link

arnabk commented Dec 11, 2023

👍

@angular-robot angular-robot bot added feature: under consideration Feature request for which voting has completed and the request is now under consideration and removed feature: votes required Feature request which is currently still in the voting phase labels Dec 12, 2023
clydin added a commit to clydin/angular-cli that referenced this issue Dec 13, 2023
…o application programmatic usage

Similar to the `dev-server` builder, the `application` builder's programmatic usage can now transform
the index HTML that is generated during a build. As is the case for the existing builder JavaScript
exports from the package, the new export (`buildApplication`) is also considered experimental and does
not provide the support nor semver guarantees that the builders have when used via `angular.json` configuration.

The third parameter of the `buildApplication` function can now be an extensions object with one of the fields
being `indexHtmlTransformer`. This newly introduced field allows adjusting the index HTML content.

Closes angular#26299
clydin added a commit to clydin/angular-cli that referenced this issue Dec 13, 2023
…o application programmatic usage

Similar to the `dev-server` builder, the `application` builder's programmatic usage can now transform
the index HTML that is generated during a build. As is the case for the existing builder JavaScript
exports from the package, the new export (`buildApplication`) is also considered experimental and does
not provide the support nor semver guarantees that the builders have when used via `angular.json` configuration.

The third parameter of the `buildApplication` function can now be an extensions object with one of the fields
being `indexHtmlTransformer`. This newly introduced field allows adjusting the index HTML content.

Closes angular#26299
clydin added a commit to clydin/angular-cli that referenced this issue Dec 13, 2023
…o application programmatic usage

Similar to the `dev-server` builder, the `application` builder's programmatic usage can now transform
the index HTML that is generated during a build. As is the case for the existing builder JavaScript
exports from the package, the new export (`buildApplication`) is also considered experimental and does
not provide the support nor semver guarantees that the builders have when used via `angular.json` configuration.

The third parameter of the `buildApplication` function can now be an extensions object with one of the fields
being `indexHtmlTransformer`. This newly introduced field allows adjusting the index HTML content.

Closes angular#26299
alan-agius4 pushed a commit to clydin/angular-cli that referenced this issue Dec 14, 2023
…o application programmatic usage

Similar to the `dev-server` builder, the `application` builder's programmatic usage can now transform
the index HTML that is generated during a build. As is the case for the existing builder JavaScript
exports from the package, the new export (`buildApplication`) is also considered experimental and does
not provide the support nor semver guarantees that the builders have when used via `angular.json` configuration.

The third parameter of the `buildApplication` function can now be an extensions object with one of the fields
being `indexHtmlTransformer`. This newly introduced field allows adjusting the index HTML content.

Closes angular#26299
alan-agius4 pushed a commit that referenced this issue Dec 14, 2023
…o application programmatic usage

Similar to the `dev-server` builder, the `application` builder's programmatic usage can now transform
the index HTML that is generated during a build. As is the case for the existing builder JavaScript
exports from the package, the new export (`buildApplication`) is also considered experimental and does
not provide the support nor semver guarantees that the builders have when used via `angular.json` configuration.

The third parameter of the `buildApplication` function can now be an extensions object with one of the fields
being `indexHtmlTransformer`. This newly introduced field allows adjusting the index HTML content.

Closes #26299
@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 Jan 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
angular/build:application area: @angular-devkit/build-angular 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
3 participants