How to add async attribute in script tag & preload attribute in link tag ?

We need to add preload attribute in platform.less file & async in telligent.evolution.min.js or any other javascript & css ?

How we can do that?

Thanks,

Rahul

  • There is not currently support for async or preload for the platform resources (platform.less or telligent.evolution.min.js). Platform.less is rendered and used on most/all pages so a preload would not result in a benefit (it'll already be referenced early in the header). telligent.evolution.min.js provides shared script resources that are used by other UI and widgets which don't currently initialize in a way that could support async loading (it would require changes to how the script components in telligent.evolution.min.js are implemented and initialized).

    Within themes and widgets, the following code can be used to register files for preloading:

    $core_v2_page.AddLink('preload', 'URL', "%{ as='TYPE', type='MIME_TYPE' }")

    For scripts rendered from widgets, the async attribute can be added to the <script src="URL"> markup rendered by the widget.

    For theme-defined scripts that are automatically included by being defined in the theme's Scripts list, there is not currently a way to configure async loading. 

    I've logged a bug to review async and preload usage in platform-defined functionality:

    TE-15792

    And to add support for async loading of theme-defined scripts:

    TE-15791