Part of the Libraries ecosystem · 4 projects
This module allows you to define assets within library definitions that can be optionally included. This is useful for assets that are not always needed and can improve performance by only loading them when necessary.
Allows optional assets in library definitions.
Post-Installation
Add the optional library to the library definition in your module's libraries.yml file as shown below
global:
version: 1.x
css:
theme:
dist/app.css: { }
dist/app-optional.css: { optional: true }
js:
dist/app.js: { }
dist/app-optional.js: { optional: true }
dependencies:
- core/jquery
- core/drupal
- core/drupalSettings
- core/once
Ask your assistant about Libraries optional import
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the Libraries ecosystem
Most installed first