fix ordering of stylesheets
This commit is contained in:
parent
ee4068d671
commit
2ff365765d
|
@ -15,6 +15,7 @@
|
|||
{
|
||||
<link id="app-manifest" rel="manifest" />
|
||||
}
|
||||
@Html.Raw(Model.StyleSheets)
|
||||
<link id="app-stylesheet-page" />
|
||||
<link id="app-stylesheet-module" />
|
||||
<component type="typeof(Oqtane.Head)" render-mode="@((RenderMode)Enum.Parse(typeof(RenderMode), Model.RenderMode, true))" />
|
||||
|
|
|
@ -21,7 +21,6 @@ using Oqtane.Security;
|
|||
using Oqtane.Extensions;
|
||||
using Oqtane.Themes;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.UI;
|
||||
|
||||
namespace Oqtane.Pages
|
||||
{
|
||||
|
@ -69,6 +68,7 @@ namespace Oqtane.Pages
|
|||
public string RemoteIPAddress = "";
|
||||
public string HeadResources = "";
|
||||
public string BodyResources = "";
|
||||
public string StyleSheets = "";
|
||||
public string PWAScript = "";
|
||||
public string ReconnectScript = "";
|
||||
public string Message = "";
|
||||
|
@ -167,6 +167,8 @@ namespace Oqtane.Pages
|
|||
}
|
||||
|
||||
// stylesheets
|
||||
if (!HttpContext.Request.Query.ContainsKey("method") || (HttpContext.Request.Query.ContainsKey("method") && HttpContext.Request.Query["method"] == "old"))
|
||||
{
|
||||
var resources = new List<Resource>();
|
||||
if (string.IsNullOrEmpty(page.ThemeType))
|
||||
{
|
||||
|
@ -186,7 +188,8 @@ namespace Oqtane.Pages
|
|||
resources.AddRange(obj.Resources.Where(item => item.ResourceType == ResourceType.Stylesheet).ToList());
|
||||
}
|
||||
}
|
||||
ManageResources(resources, alias, theme.ThemeName);
|
||||
ManageStyleSheets(resources, alias, theme.ThemeName);
|
||||
}
|
||||
|
||||
// scripts
|
||||
if (Runtime == "Server")
|
||||
|
@ -494,7 +497,7 @@ namespace Oqtane.Pages
|
|||
CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)));
|
||||
}
|
||||
|
||||
private void ManageResources(List<Resource> resources, Alias alias, string name)
|
||||
private void ManageStyleSheets(List<Resource> resources, Alias alias, string name)
|
||||
{
|
||||
if (resources != null)
|
||||
{
|
||||
|
@ -510,15 +513,11 @@ namespace Oqtane.Pages
|
|||
resource.Url = alias.BaseUrl + resource.Url;
|
||||
}
|
||||
|
||||
if (!HeadResources.Contains(resource.Url, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string id = "";
|
||||
if (!HttpContext.Request.Query.ContainsKey("method") || (HttpContext.Request.Query.ContainsKey("method") && HttpContext.Request.Query["method"] == "old"))
|
||||
if (!StyleSheets.Contains(resource.Url, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
count++;
|
||||
id = "id=\"app-stylesheet-" + ResourceLevel.Page.ToString().ToLower() + "-" + DateTime.UtcNow.ToString("yyyyMMddHHmmssfff") + "-" + count.ToString("00") + "\" ";
|
||||
}
|
||||
HeadResources += "<link " + id + "rel=\"stylesheet\" href=\"" + resource.Url + "\"" + (!string.IsNullOrEmpty(resource.Integrity) ? " integrity=\"" + resource.Integrity + "\"" : "") + (!string.IsNullOrEmpty(resource.CrossOrigin) ? " crossorigin=\"" + resource.CrossOrigin + "\"" : "") + " type=\"text/css\"/>" + Environment.NewLine;
|
||||
string id = "id=\"app-stylesheet-" + ResourceLevel.Page.ToString().ToLower() + "-" + DateTime.UtcNow.ToString("yyyyMMddHHmmssfff") + "-" + count.ToString("00") + "\" ";
|
||||
StyleSheets += "<link " + id + "rel=\"stylesheet\" href=\"" + resource.Url + "\"" + (!string.IsNullOrEmpty(resource.Integrity) ? " integrity=\"" + resource.Integrity + "\"" : "") + (!string.IsNullOrEmpty(resource.CrossOrigin) ? " crossorigin=\"" + resource.CrossOrigin + "\"" : "") + " type=\"text/css\"/>" + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user