Is there an existing issue for this?
What happened?
See code below for details and to reproduce using any skin .ascx
Updated: These first two were mistakes on my part, see comment below on using .CreateFont().
Issue 6a: mystery word replacement, .AddAttribute("as", "font") resolves to and/or adds duplicate "as" attribute: as="style"
Issue 6b: attribute order, they do not render in the order added (not sure this matters, but at least it makes it hard to proof and double check against expectations)
Issue 6c: .ResolvedPath is empty until you .AddStylesheet() or .Register()
Issue 6d: IntelliSense weirdness, see below under Anything Else.
Issue 6e: .SetPriority(99) with CreateFont() did not work as expected (code in comment below) putting the two added fonts first above things I have in priority 1-10. Should fonts come first?
Issue 6f: dupe elimination works, but with unexpected results, see comment below.
Note: issue w double forward slash already reported in #6850
Steps to reproduce?
In an existing skin file (e.g. /default.ascx) add this after your registers:
<!--#include file="cdf-test.ascx"-->
Then create a new file in the same folder as your existing skin file named cdf-test.ascx
Copy the following into the new file and save:
<%@ Import Namespace="Microsoft.Extensions.DependencyInjection" %>
<%@ Import Namespace="DotNetNuke.Common.Extensions" %>
<%@ Import Namespace="DotNetNuke.Abstractions" %>
<%@ Import Namespace="DotNetNuke.Abstractions.ClientResources" %>
<%@ Import Namespace="DotNetNuke.Web.Client.ResourceManager" %>
<script runat="server">
private IClientResourceController _clientResourceController;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
AddResources();
}
private void AddResources()
{
// TODO convert to v10 parameterless and/or newer/simpler version mentioned in forums
IServiceScope currentScope = HttpContext.Current.GetScope();
IServiceProvider serviceProvider = currentScope.ServiceProvider;
this._clientResourceController = serviceProvider.GetRequiredService<IClientResourceController>();
var fontyBoldo = _clientResourceController.CreateStylesheet("pathto/fonty-boldo.woff2", PathNameAlias.SkinPath)
.SetPreload()
.AddAttribute("as", "font")
.AddAttribute("type", "font/woff2")
.SetPriority(7)
.SetProvider(ClientResourceProviders.DnnPageHeaderProvider)
.SetCrossOrigin(CrossOrigin.Anonymous)
;
// log(fontyBoldo?.ResolvedPath);
_clientResourceController.AddStylesheet(fontyBoldo);
// log(fontyBoldo?.ResolvedPath);
}
</script>
Current Behavior
Results from code above in DNN v10.02.01
<link href="/Portals/_default/skins/accutheme-tw4//pathto/fonty-boldo.woff2?cdv=306" rel="preload" as="style" crossorigin="anonymous" as="font" type="font/woff2" />
Note there as two "as" attributes!
Expected Behavior
Expected output
<link href="/Portals/_default/skins/accutheme-tw4/pathto/fonty-boldo.woff2?cdv=306" rel="preload" as="font" type="font/woff2" crossorigin="anonymous" />
Relevant log output
Anything else?
The IntelliSense in VS Code that I have setup appears to reveal that DotNetNuke.Web.Client.ResourceManager is only compiled to netstandard2.0 and not net48+.
I use NuGet package references to load DotNetNuke.Bundle which includes DotNetNuke.Web.Client and if you drill into the NuGet package it also seems to indicate that it does not have a version available compiled to net48+
Affected Versions
10.02.01 (latest v10 release)
What browsers are you seeing the problem on?
Chrome
Code of Conduct
Is there an existing issue for this?
What happened?
See code below for details and to reproduce using any skin .ascx
Updated: These first two were mistakes on my part, see comment below on using .CreateFont().
Issue 6a: mystery word replacement,.AddAttribute("as", "font")resolves to and/or adds duplicate "as" attribute:as="style"Issue 6b: attribute order, they do not render in the order added (not sure this matters, but at least it makes it hard to proof and double check against expectations)Issue 6c: .ResolvedPath is empty until you
.AddStylesheet()or.Register()Issue 6d: IntelliSense weirdness, see below under Anything Else.
Issue 6e: .SetPriority(99) with CreateFont() did not work as expected (code in comment below) putting the two added fonts first above things I have in priority 1-10. Should fonts come first?
Issue 6f: dupe elimination works, but with unexpected results, see comment below.
Note: issue w double forward slash already reported in #6850
Steps to reproduce?
In an existing skin file (e.g. /default.ascx) add this after your registers:
<!--#include file="cdf-test.ascx"-->Then create a new file in the same folder as your existing skin file named
cdf-test.ascxCopy the following into the new file and save:
Current Behavior
Results from code above in DNN v10.02.01
Note there as two "as" attributes!
Expected Behavior
Expected output
Relevant log output
Anything else?
The IntelliSense in VS Code that I have setup appears to reveal that
DotNetNuke.Web.Client.ResourceManageris only compiled to netstandard2.0 and not net48+.I use NuGet package references to load DotNetNuke.Bundle which includes DotNetNuke.Web.Client and if you drill into the NuGet package it also seems to indicate that it does not have a version available compiled to net48+
Affected Versions
10.02.01 (latest v10 release)
What browsers are you seeing the problem on?
Chrome
Code of Conduct