Skip to content

Commit

Permalink
Documents HtmlAttributesAsString usage with SPA tokens
Browse files Browse the repository at this point in the history
This assumes that dnnsoftware/Dnn.Platform#5242 gets merged first...
  • Loading branch information
valadas authored Aug 31, 2022
1 parent 18c1f88 commit 7d927f2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions content/tutorials/client-resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ When requesting a script or CSS file, a name and version can also be specified,
[JavaScript:{ path: "/Portals/_default/Skins/MySkin/Scripts/mySliders.min.js", priority: 10001, provider: "DnnFormBottomProvider" }]
```

If `jsname` is provided but `path` is not provided, DNN will load the pre-installed javascript library (extension).

If both `jsname` and `path` are provided, `jsname` only serves to add a comment in the resulting html (to help troubleshooting) but the file in `path` is registered.

#### WebForms

```html
Expand All @@ -94,6 +98,13 @@ When using the WebForms controls, there's an additional attribute, `HtmlAttribut
<dnn:DnnJsInclude runat="server" FilePath="https://www.google.com/recaptcha/api.js" ForceProvider="DnnPageHeaderProvider" HtmlAttributesAsString="async:async,defer:defer" />
```

Starting with DNN v9.11.0, `htmlAttributesAsString` can also be used in the SPA token to add custom html attributes to a script tag:
```html
[JavaScript:{ path: "/DesktopModules/ResourceManager/Scripts/dnn-resource-manager/dnn-resource-manager.esm.js", htmlAttributesAsString: "type:module"}]
[JavaScript:{ path: "/DesktopModules/ResourceManager/Scripts/dnn-resource-manager/dnn-resource-manager.js", htmlAttributesAsString: "nomodule:nomodule"}]
[JavaScript:{ path: "https://www.google.com/recaptcha/api.js", htmlAttributesAsString: "async:async,defer:defer"}]
```

##### Remove and replace CSS and JS requests

There are two additional theme objects, `DnnCssExclude` and `DnnJsExclude` which can stop a requested CSS or JavaScript file from being included on the page. A common usage of this feature is for a theme to stop DNN from including its default CSS:
Expand Down

0 comments on commit 7d927f2

Please sign in to comment.