Asset.script ViewHelper <vite:asset.script>
The <vite: ViewHelper allows to customize the embedding of
script assets with the <vite: ViewHelper. It can only be used as a
direct child element of <vite:.
See <vite:asset> for more examples.
Example: Disable preloading of imports
<vite:asset entry="EXT:sitepackage/Resources/Private/JavaScript/Main.entry.js">
<vite:asset.script preloadImports="{false}" />
</vite:asset>
Copied!
Arguments
The following arguments are available for the asset.script ViewHelper:
additionalAttributes
-
- Type
- array
- Default
- array ( )
Additional attributes to be added to the <script> tag.
async
-
- Type
- bool
- Default
- false
Set to "true" if the script should be executed as soon as it is loaded. Can be used for JavaScript modules and classic scripts.
defer
-
- Type
- bool
- Default
- false
Set to "true" if the classic script should be executed after the document has been parsed. JavaScript modules are always deferred, so this can only be used with module="{false}".
ignore
-
- Type
- bool
- Default
- false
Set to "true" if the script should not be embedded at all.
module
-
- Type
- bool
- Default
- true
Set to "false" if the script should be embedded as a classic script instead of a JavaScript module (e. g. for non-ESM build output).
nomodule
-
- Type
- bool
- Default
- false
Set to "true" if the classic script should be used as an alternative to a JavaScript module. Can only be used with module="{false}".
preloadImports
-
- Type
- bool
- Default
- true
Set to "false" if imported scripts should not be preloaded automatically.
priority
-
- Type
- bool
- Default
- false
Set to "true" if the script should be embedded in the <head> of the document.