What is the difference between "@Scripts.Render" and "<script>"?

asp.net, c#, razor

Solution

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.

Problem

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.

Original source

Related problems