I\'m trying to render a JavaScript bundle using Microsoft\'s Web Optimization framework, like this:
@Scripts.Render(\"~/assets/bundle.js\")
One easy way is with Scripts.RenderFormat:
@Scripts.RenderFormat("","~/assets/bundle.js")
A way to get URL from request. Couldn't seem to use multiple parameters with the RenderFormat, so that's why it looks a little ugly:
@Scripts.RenderFormat("", "~/assets/bundle.js")
or better yet, centralize a function to get the correct path (using a fictional function):
@Scripts.RenderFormat("", "~/assets/bundle.js")
Also, you don't need the .js
on the bundle:
bundles.Add(new ScriptBundle("~/assets/bundle")