Script
This class represents a script media asset, specifically designed to generate HTML script tags. It utilizes a template to format the source path and any additional attributes into a standard script element. As a subclass of MediaAsset, it provides a structured way to manage and render JavaScript file references within a web context.
Attributes
| Attribute | Type | Description |
|---|---|---|
| element_template | string = < script src="{path}"{attributes} >< /script > | The HTML template string used to render the script tag, containing placeholders for the source path and additional attributes. |
Constructor
Signature
def Script(
src: string,
**attributes: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| src | string | The source path for the script file. |
| **attributes | dict | Additional HTML attributes to be included in the script tag. |
Signature
def Script(
src: string,
**attributes: dict
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| src | string | The file path or URL to the JavaScript source file. |
| **attributes | dict | A collection of key-value pairs representing HTML attributes to be rendered on the script tag, such as 'async' or 'defer'. |