Get the environment name in a Twig template with Symfony2

GergelyPolonkai picture GergelyPolonkai · Apr 17, 2012 · Viewed 50.3k times · Source

Is there a way to get the name of the current environment in a Twig template? I'd like to set some CSS style values depending on it.

Answer

marka.thore picture marka.thore · Apr 17, 2012

http://symfony.com/doc/current/templating/app_variable.html:

<p>Application Environment: {{ app.environment }}</p>