admin管理员组文章数量:1431726
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'
%} [...]
本文标签: symfonyTwig comments injavascripts Stack Overflow
版权声明:本文标题:symfony - Twig: comments in {% javascripts %} - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745585481a2664877.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论