In my skin, I am using JavaScriptLibraryInclude to load popper.js and bootstrap. It seems the modules load at the bottom of the HTML. However, this causes issues with some modules. I found through experimentation that if I load popper and bootstrap above the modules, everything works fine. Is there a way to force JavaScriptLibraryInclude to specify the location in the page where the libraries will load so I can force them to load at the top of the page? Or do I just need to go back to static js references?
Yes you can set the order.
From the documentation HTH:
If you'd like to register a resource file in code, you can do so using the ClientResourceManager found in DotNetNuke.Web.Client. First add a reference to the assembly, and then make use of any of the API methods listed below. For more information about priority and providers, please see their respective sections below. There are a few different overloads for registering a stylesheet, the most common is listed first:
RegisterStyleSheet(Page page, string filePath) //default provider and default priority RegisterStyleSheet(Page page, string filePath, int priority) // default provider RegisterStyleSheet(Page page, string filePath, FileOrder.Css priority) // default provider, uses FileOrder enumeration (primarily for internal framework use) RegisterStyleSheet(Page page, string filePath, int priority, string provider)
There are also a few overloads for registering a JavaScript file, again, the most common are listed first.
RegisterScript(Page page, string filePath) // default priority and provider RegisterScript(Page page, string filePath, int priority) // default provider RegisterScript(Page page, string filePath, FileOrder.Js priority) // default provider, uses fileorder enumeration RegisterScript(Page page, string filePath, FileOrder.Js priority, string provider) // no defaults RegisterScript(Page page, string filePath, int priority, string provider) // no defaults
There is an enumeration that defines the file load order (priority) of each of the internal files that the DNN framework is responsible for loading. They have been spaced out a bit so that an extension developer can sneak their files in wherever they like. Note: the FileOrder enumeration is not intended to be used outside of the core application. For instance, if you want to register something after jQuery but before jQuery UI - you would use a value of 6,7,8 or 9 when registering the script. Or you could use your own enumeration (e.g. MyFileOrder.AfterjQueryBeforejQueryUI) to give a good name to the number. JavaScript priorities:
Default: 100 jQuery: 5 jQuery UI: 10 DnnXxml: 15 DnnXmlJsParser: 20 DnnXmlHttp: 25 DnnXmlHttpJsXmlHttpRequest: 30 DnnDomPositioning: 35 DnnControls: 40 DnnControlsLabelEdit: 45
CSS priorities:
DefaultCss: 5 ModuleCss: 10 SkinCss: 15 SpecificSkinCss: 20 ContainerCss: 25 SpecificContainerCss: 30 PortalCss: 35
It also applies to skins.
< dnn:DnnJsInclude runat="server" FilePath="/vendors/popper/umd/popper.min.js" PathNameAlias="SkinPath" Priority="10" /> < dnn:DnnJsInclude runat="server" FilePath="/vendors/custom-bootstrap/js/bootstrap.min.js" PathNameAlias="SkinPath" Priority="11" /> You can find more info on the priority and how it works here: https://www.dnnsoftware.c...ource-management-api
Ok, you are loading the installed libraries I'm not sure if they support an order too TBH
Yes, that is the case. Sorry if I wasn't clear. I might have to move to statically loaded instead of that if I can't change that. :-/
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.