0

I would like to add a JavaScript call to my html.html.twig file, but there are two separate .js sources depending on which environment I'm on (production, and non-production). I believe Acquia Cloud (which we use) provides such variables, but they are for PHP.

I'm still relatively new to Drupal 8, so I might be missing something obvious with this, but...is there a way to use Acquia Cloud's environment variables in a Twig template?

(EDIT) I forgot to mention that I tried accessing the environment variables from a few preprocess hook functions, e.g. themename_preprocess_html() and themename_preprocess_page(), but they are apparently not set at all.

1

So I guess my problem was that I was on a Local environment, where Acquia does not provide any environment variables. I had to push my test code to Dev in order to see any effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.