Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documents HtmlAttributesAsString usage with SPA tokens #684

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
valadas marked this conversation as resolved.
Show resolved Hide resolved
valadas marked this conversation as resolved.
Show resolved Hide resolved

#### 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"}]
```

valadas marked this conversation as resolved.
Show resolved Hide resolved
##### 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