Twig: comments in {% javascripts %}

javascript, symfony, twig

Solution

That is unsupported twig syntax, obviously. So it's up to you how to hide it. I would do something like this:

{#    'js/functions.js'#}
{% javascripts
    'js/plugins.js'
    'js/editor.js'
    'js/calendar.js'
%} [...]

Problem

I have a situation like this in my twig file: ``` {% javascripts 'js/functions.js' 'js/plugins.js' 'js/editor.js' 'js/calendar.js' %} [...] ``` And I would love to comment some scripts out using ``` {% javascripts {# 'js/functions.js' #} 'js/plugins.js' 'js/editor.js' 'js/calendar.js' %} [...] ``` But this isnt allowed, I get an `Unexpected character "#"` error. Is there a common practice how to handle this?

Original source