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

Conditional template logic in index.html for beta.11-webpack #1544

Closed
onedotover opened this issue Aug 4, 2016 · 5 comments
Closed

Conditional template logic in index.html for beta.11-webpack #1544

onedotover opened this issue Aug 4, 2016 · 5 comments

Comments

@onedotover
Copy link

onedotover commented Aug 4, 2016

Version 1.0.0-beta.11-webpack

Issue Handlebar template processing removed?

Detail
As noted in the https://github.com/angular/angular-cli/blob/master/WEBPACK_UPDATE.md document, the handlebar template logic was removed from index.html. It looks like there is no longer support for conditional logic in the index.html file using handlebars. Is that correct?

Including something like {{#if environment.production}} Only show in production build. {{/if}} the template is not processed. Has this feature been removed (or will it be)? I think this is an incredibly useful feature for including things like Google Analytics, Facebook, etc with API keys.

@filipesilva
Copy link
Contributor

It has been removed, yes. My suggestion for those tokens is to use the environment files feature: https://github.com/angular/angular-cli#build-targets-and-environment-files.

It won't allow you to have different index.html content, but will allow you to customize tokens and whatever other code you put in each.

For things you absolutely 100% need to load remotely, my recommendation for now is https://github.com/ded/script.js.

@gruckus-gruckus
Copy link

So how can the index.html/index.ejs be transformed? With no access to environment variables or webpack config, this seems extremely limiting. The addition of the --base-href flag seems to illustrate pretty strongly that a precompile stage needs to be exposed.

@jrmcdona
Copy link

jrmcdona commented Aug 1, 2017

@awexfwex did you end up getting Handlebars to work with Angular4? I am in the same boat with trying to get some items from a service and into the head tags on index.html. It is very easy with Handlebars/Express in my tests but I am looking to put it all together with Angular.

@gruckus-gruckus
Copy link

gruckus-gruckus commented Aug 2, 2017

@jrmcdona We stopped using the cli, and set things up the old fashioned way. The decision was for finer control over easier configuration. I haven't kept up with the angular-cli project, so not sure if this is possible now or not.

@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants