关于 Grails 中 javascript src 和 javascript 库之间差异的文档
我知道,如果您在视图中写入:
<g:javascript src="myscript.js" />
<g:javascript src="myscript.js" />
<g:javascript src="myscript.js" />
<!-- other try -->
<g:javascript library="myscript" />
<g:javascript library="myscript" />
<g:javascript library="myscript" />
它将输出:
<script type="text/javascript" src="/vip/js/myscript.js"></script>
<script type="text/javascript" src="/vip/js/myscript.js"></script>
<script type="text/javascript" src="/vip/js/myscript.js"></script>
<!-- other try -->
<script type="text/javascript" src="/vip/js/myscript.js"></script>
结论:对于库,它将尝试仅包含一次。
我一直试图找到有关它的文档但没有成功。
你有指针吗?
I know that if you write in a view:
<g:javascript src="myscript.js" />
<g:javascript src="myscript.js" />
<g:javascript src="myscript.js" />
<!-- other try -->
<g:javascript library="myscript" />
<g:javascript library="myscript" />
<g:javascript library="myscript" />
It will out output:
<script type="text/javascript" src="/vip/js/myscript.js"></script>
<script type="text/javascript" src="/vip/js/myscript.js"></script>
<script type="text/javascript" src="/vip/js/myscript.js"></script>
<!-- other try -->
<script type="text/javascript" src="/vip/js/myscript.js"></script>
Conclution: with library it will try to include only once.
I have been try to find documentation about it without success.
Do you have any pointer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,源代码
查看文档 (http://grails.org/ doc/latest/ref/Tags/javascript.html) 然后单击
显示源代码
,您将看到代码仅在第一次输出if(!request[INCLUDED_LIBRARIES] .contains(attrs.library)) {
希望这有帮助。
Yes the Source Code
Check out the Documentation (http://grails.org/doc/latest/ref/Tags/javascript.html) then click
Show Source
you will see the code is only going to output the first timeif(!request[INCLUDED_LIBRARIES].contains(attrs.library)) {
Hope this helps.