I want to embed various stylesheets with assetic in the twig template of the Symfony2 project. The style sheet used depends on the user theme setting.
I used
{% stylesheets '@CuteFlowCoreBundle/Resources/public/css/application.css' '@CuteFlowCoreBundle/Resources/public/css/theme/'~app.session.get('cuteflow_theme')~'/application.css' %} <link rel="stylesheet" href="{{ asset_url }}" type="text/css" media="all" /> {% endstylesheets %}
But this causes an error:
Unexpected token "operator" of value "~" in "CoreBundle::layout.html.twig"
I also tried the following. But that didn't help either.
{% set theme = '@CuteFlowCoreBundle/Resources/public/css/theme/'~app.session.get('cuteflow_theme')~'/application.css' %} {% stylesheets '@CuteFlowCoreBundle/Resources/public/css/application.css' theme %} <link rel="stylesheet" href="{{ asset_url }}" type="text/css" media="all" /> {% endstylesheets %}
Any ideas how to do this?
source share