"@ Scripts.Render"和"@ Scripts.Render"之间有什么区别?和“< script>"? [英] What is the difference between "@Scripts.Render" and "<script>"?

查看:62
本文介绍了"@ Scripts.Render"和"@ Scripts.Render"之间有什么区别?和“< 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"之间有什么区别?和“&lt; script&gt;"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆