"@ Scripts.Render"和"@ Scripts.Render"之间有什么区别?和“< script>"? [英] What is the difference between "@Scripts.Render" and "<script>"?
问题描述
我想了解 @ Scripts.Render(〜/something.js")
和< script type ="text/javascript" src ="/something之间的区别.js></script>
.
是的,我已经搜索过这个主题,但是没有成功.我认为 @ Scripts.Render
是否存在并非偶然.
更多详细信息
我的意思是:什么时候应该使用一个或另一个,为什么?
Scripts.Render用于捆绑,如果将多个脚本捆绑在一起并给它们命名,则可以使用此语句将它们一起渲染.
在调试模式下,它们将呈现多个标签,并且在生产中,您可以部署单个捆绑脚本.在web.config中将调试模式设置为true或false:
< system.web>< compilation debug ="true" .../>
此处涉及捆绑.>
I want to know about the difference between @Scripts.Render("~/something.js")
and <script type="text/javascript" src="/something.js"></script>
.
Yes, I've already searched about this subject, but with no success. I think if @Scripts.Render
exists isn't by chance.
More details
What I'm meaning is: when I should use one or other and why.
Scripts.Render is used for bundling, if you bundle multiple scripts together and give them a name, then you can render them all together using this statement.
On debug mode, they'll render multiple tags, and in production you can deploy a single bundled script. Debug mode is set true or false in the web.config:
<system.web>
<compilation debug="true" ... />
Here is more about bundling.
这篇关于"@ Scripts.Render"和"@ Scripts.Render"之间有什么区别?和“< script>"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!