I'm trying to render a JavaScript bundle using Microsoft's Web Optimization framework, like this:
@Scripts.Render("~/assets/bundle.js")
And building a small bundle, like this:
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/assets/bundle.js")
.Include(
"~/scripts/jquery-2.1.0.min.js",
"~/scripts/somescript.js"
));
...
}
But when optimizations are on, it only renders a relative URL, like this:
<script src="/assets/bundle.js?v=mGDOiNaiTrSfcNq41OoA7A_BcN8PrXuMbfl-TE84HVY1"></script>
How can I have script bundling render an absolute URL instead? I couldn't find a way to do this looking through the docs on MSDN. This is what I would ultimately like:
<script src="http://my.site.com/assets/bundle.js?v=mGDOiNaiTrSfcNq41OoA7A_BcN8PrXuMbfl-TE84HVY1"></script>
Is this in the framework, or do I have to roll a helper method with Script.Url
?