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 ment 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 mon practice how to handle this?
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 ment 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 mon practice how to handle this?
Share Improve this question edited Nov 25, 2012 at 16:50 a1337q asked Nov 25, 2012 at 16:38 a1337qa1337q 7803 gold badges10 silver badges20 bronze badges 4-
2
I believe you'll have to remove
js/functions.js
line. You can move it to separate ment, just to remember that it was there. – Crozin Commented Nov 25, 2012 at 16:54 - @Crozin, okay. This is the way I'm doing it now, but it's not very handy. – a1337q Commented Nov 25, 2012 at 17:03
- this is what version control was built for, you shouldn't have to leave mented code in your files long term – JamesHalsall Commented Nov 26, 2012 at 8:37
- 1 @Jaitsu yes and no. Since the order of the script matters, I need to have it somewhere. But generally you're correct of course, dead code is ugly as hell. Best variant for my problem is probably to leave a plete block mented out on purpose somewhere in a template. – a1337q Commented Nov 26, 2012 at 13:06
1 Answer
Reset to default 4That 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'
%} [...]