Change the .libraries.yml file not to use weight for JavaScript files

Created on 13 July 2024, 9 months ago

The JavaScript Example module shows how to load a JavaScript file before another one, by setting the weight property for each file.

That is a bad example, as the comments say, but it is also not necessary: Drupal core includes the loadjs library, which exactly for running JavaScript code once a file has been loaded from the browser. It is only used by Drupal.ajax, but the code used from Drupal core can be used as example to write our code.

As to show how to use a property for assets files part of a library, it would be sufficient to use attributes and id.

📌 Task
Status

Active

Version

4.0

Component

JavaScript Example

Created by

🇮🇹Italy apaderno Brescia, 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024