Resources - Accuraty/AccuTheme-Bs4 GitHub Wiki

The proper way to get DNN to include a resource on a page is to use either DnnJsInclude or DnnCssInclude. You can do this in themes using the SkinObjects, in code by calling these functions, or even just dropping them on the page as needed (see /Portals/0/2sxc/Content/Shared/_Assets.cshtml for examples).

Example (not recommended) showing both ASYNC and DEFER

<dnn:DnnJsInclude 
  FilePath="https://kit.fontawesome.com/9999999999.js"
  ForceProvider="DnnFormBottomProvider"
  Priority="100"
  HtmlAttributesAsString="async:async,defer:defer,crossorigin:anonymous"
  runat="server"
/>

Results in:

<script src="https://kit.fontawesome.com/90e9235c3d.js" async="async" defer="defer" crossorigin="anonymous" type="text/javascript"></script>

Recommended (for Accuraty projects)

The following ones have been researched and tested, these are the RECOMMENDED settings for getting these things on the page and for AccuThem these normally these appear in /Portals/_default/skins/AccuTheme/includes/_preheader.ascx.

FontAwesome Pro Kit

Last reviewed 20201017 JRF

<dnn:DnnJsInclude
  FilePath="https://kit.fontawesome.com/0123456789.js"
  ForceProvider="DnnFormBottomProvider"
  Priority="100"
  HtmlAttributesAsString="async:async,defer:defer,crossorigin:anonymous"
  runat="server"
/>

Adobe TypeKit CSS include

Last reviewed 20201017 JRF

<dnn:DnnCssInclude
  FilePath="https://use.typekit.net/nnnnnn7.css"
  Priority="1"
  HtmlAttributesAsString="async:async,defer:defer"
  runat="server"
/>

Do the same thing in code?

This is a good example because it lets us conditionally add something IF the file exists:

<% 
if ( AccuTheme.skinFileExists(AccuTheme.SkinJsPath, "common.bundle.js") ) 
{ 
  ClientResourceManager.RegisterScript(
    this.Page, 
    AccuTheme.SkinJsPath + "/" + "common.bundle.js", 
    103,
    "DnnFormBottomProvider"
  );
}
%>

Notes:

  • we like to pronouce "resources," "race horses."
⚠️ **GitHub.com Fallback** ⚠️