Q:

Loading css according to dev or prod environment

Config :
Symfony 3.4 - Webpack Encore
in practice, I need to use a different background-color on body, according to the dev, test or prod environment.
I know I can do something like this in twig :
{{ app.environment }}

But I'm not sure it's a good practice !
Is there a way to do that through my yaml configs (config_dev.yml, config_test.yml, config_prod.yml) ?
Or a way to do that through my webpack.config.js ?

A:

Using current environment as a body CSS class has nothing wrong in my opinion. I.e.
<body class="{{ app.environment }}">

and then you don't even have to load different CSS stylesheets, you only need different classes definitions in the same CSS, e.g.
body.prod {background-color: white}
body.dev {background-color: lightyellow}
body.test {background-color: lightgreen}
...

