Merge pull request #2010 from sbwalker/dev
Add support for ES6 module JavaScript resources
This commit is contained in:
commit
e305c488d4
|
@ -55,7 +55,7 @@ namespace Oqtane.Modules
|
|||
var scripts = new List<object>();
|
||||
foreach (Resource resource in Resources.Where(item => item.ResourceType == ResourceType.Script && item.Declaration != ResourceDeclaration.Global))
|
||||
{
|
||||
scripts.Add(new { href = resource.Url, bundle = resource.Bundle ?? "", integrity = resource.Integrity ?? "", crossorigin = resource.CrossOrigin ?? "" });
|
||||
scripts.Add(new { href = resource.Url, bundle = resource.Bundle ?? "", integrity = resource.Integrity ?? "", crossorigin = resource.CrossOrigin ?? "", ismodule = resource.IsModule ?? false});
|
||||
}
|
||||
if (scripts.Any())
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Oqtane.Themes
|
|||
var scripts = new List<object>();
|
||||
foreach (Resource resource in Resources.Where(item => item.ResourceType == ResourceType.Script && item.Declaration != ResourceDeclaration.Global))
|
||||
{
|
||||
scripts.Add(new { href = resource.Url, bundle = resource.Bundle ?? "", integrity = resource.Integrity ?? "", crossorigin = resource.CrossOrigin ?? "" });
|
||||
scripts.Add(new { href = resource.Url, bundle = resource.Bundle ?? "", integrity = resource.Integrity ?? "", crossorigin = resource.CrossOrigin ?? "", ismodule = resource.IsModule ?? false });
|
||||
}
|
||||
if (scripts.Any())
|
||||
{
|
||||
|
|
|
@ -232,6 +232,9 @@ Oqtane.Interop = {
|
|||
if (path === scripts[s].href && scripts[s].crossorigin !== '') {
|
||||
element.crossOrigin = scripts[s].crossorigin;
|
||||
}
|
||||
if (path === scripts[s].href && scripts[s].ismodule === true) {
|
||||
element.type = "module";
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -33,8 +33,7 @@ namespace Oqtane.Models
|
|||
public string Bundle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the Resource is global, meaning that the entire solution uses it or just some modules.
|
||||
/// TODO: VERIFY that this explanation is correct.
|
||||
/// Determines if the Resource is global or local, meaning that the entire solution uses it or just some modules.
|
||||
/// </summary>
|
||||
public ResourceDeclaration Declaration { get; set; }
|
||||
|
||||
|
@ -42,5 +41,10 @@ namespace Oqtane.Models
|
|||
/// If the Resource should be included in the `head` of the HTML document or the `body`
|
||||
/// </summary>
|
||||
public ResourceLocation Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For Scripts this allows type="module" registrations - not applicable to Stylesheets
|
||||
/// </summary>
|
||||
public bool? IsModule { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user