I have looked through Google and Stackoverflow and haven\'t found an answer for this. Is there any built in way to make a bundle execute as deffered or does someone know of an e
The answer above is great. I just want to quickly paste my code over here for those who wants to have a more concise syntax.
Add a new C# class
// --------------------------------------------------------------------------------------------------------------------
//
// http://believeblog.azurewebsites.net/
//
// --------------------------------------------------------------------------------------------------------------------
using System.Web;
using System.Web.Optimization;
namespace MVCExtension
{
///
/// The scripts.
///
public static class Scripts
{
///
/// Render scripts as deferred
///
///
/// The paths.
///
///
/// The .
///
public static IHtmlString RenderDefer(params string[] paths)
{
return Scripts.RenderFormat(@"", paths);
}
}
}
Then, use Razor syntax:
@Scripts.RenderDefer("~/bundles/jquery")
Or Webform syntax:
<%: Scripts.RenderDefer("~/bundles/jquery") %>