/// <summary> /// Add script element /// </summary> /// <param name="html">HTML helper</param> /// <param name="location">A location of the script element</param> /// <param name="src">Script path (minified version)</param> /// <param name="debugSrc">Script path (full debug version). If empty, then minified version will be used</param> /// <param name="excludeFromBundle">A value indicating whether to exclude this script from bundling</param> /// <param name="isAsync">A value indicating whether to add an attribute "async" or not for js files</param> public static void AddScriptParts(this IHtmlHelper html, ResourceLocation location, string src, string debugSrc = "", bool excludeFromBundle = false, bool isAsync = false) { IPageHeadBuilder pageHeadBuilder = ServiceProviderFactory.ServiceProvider.GetService <IPageHeadBuilder>(); pageHeadBuilder.AddScriptParts(location, src, debugSrc, excludeFromBundle, isAsync); }
/// <summary> /// Add script element /// </summary> /// <param name="html">HTML helper</param> /// <param name="location">A location of the script element</param> /// <param name="part">Script part</param> /// <param name="pageHeadBuilder"></param> /// <param name="excludeFromBundle">A value indicating whether to exclude this script from bundling</param> public static void AddScriptParts(this HtmlHelper html, ResourceLocation location, string part, IPageHeadBuilder pageHeadBuilder = null, bool excludeFromBundle = false) { if (pageHeadBuilder == null) pageHeadBuilder = EngineContext.Current.Resolve<IPageHeadBuilder>(); pageHeadBuilder.AddScriptParts(location, part, excludeFromBundle); }