|
|
@ -10,6 +10,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers; |
|
|
public class ScriptTagHelper : AbpTagHelper |
|
|
public class ScriptTagHelper : AbpTagHelper |
|
|
{ |
|
|
{ |
|
|
protected AbpBundlingOptions Options { get; } |
|
|
protected AbpBundlingOptions Options { get; } |
|
|
|
|
|
|
|
|
|
|
|
[HtmlAttributeName("deferred")] |
|
|
|
|
|
public bool? Deferred { get; set; } |
|
|
|
|
|
|
|
|
public ScriptTagHelper(IOptions<AbpBundlingOptions> options) |
|
|
public ScriptTagHelper(IOptions<AbpBundlingOptions> options) |
|
|
{ |
|
|
{ |
|
|
@ -17,6 +20,16 @@ public class ScriptTagHelper : AbpTagHelper |
|
|
} |
|
|
} |
|
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
|
|
public override void Process(TagHelperContext context, TagHelperOutput output) |
|
|
{ |
|
|
{ |
|
|
|
|
|
if(Deferred == true) |
|
|
|
|
|
{ |
|
|
|
|
|
output.Attributes.Add("defer", ""); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
else if (Deferred == false) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (Options.DeferScriptsByDefault) |
|
|
if (Options.DeferScriptsByDefault) |
|
|
{ |
|
|
{ |
|
|
output.Attributes.Add("defer", ""); |
|
|
output.Attributes.Add("defer", ""); |
|
|
|