Skip to main content

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

AttributeTypeDescription
element_templatestring = < 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

NameTypeDescription
srcstringThe source path for the script file.
**attributesdictAdditional HTML attributes to be included in the script tag.

Signature

def Script(
src: string,
**attributes: dict
) - > null

Parameters

NameTypeDescription
srcstringThe file path or URL to the JavaScript source file.
**attributesdictA collection of key-value pairs representing HTML attributes to be rendered on the script tag, such as 'async' or 'defer'.