Skip to main content

Module Assets

Displaying 1 - 1 of 1

Adding assets (CSS, JS) to a Drupal module via *.libraries.yml

In Drupal 8 and later versions, stylesheets (CSS) and JavaScript (JS), jQuery, React, and even Angular, are loaded through the same system for modules (code) and themes, for everything: asset libraries. 

Asset libraries can contain one or more CSS assets, one or more JS assets, and one or more JS settings.

Drupal uses a high-level principle: assets (CSS or JS) are only loaded if you tell Drupal it should load them. 

Drupal does not load all assets (CSS/JS) on all pages because this is bad for front-end performance.