Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Library Generator

Security covered No further development

This module automatically generates CSS and JavaScript asset libraries for modules and themes. It scans specified directories to create individual libraries for each CSS and JS file, eliminating the need for manual configuration in `.libraries.yml` files.

The Library Generator module generates asset libraries for CSS and JS files in modules and themes. Use this module if you want a separate asset library for each CSS and JS file without having to add them manually to your *.libraries.yml.

CONFIGURATION

Suppose you have the following file structure:

MODULE_NAME
  dist
    css
      0
        lib1.css
        lib2.css
      1
        lib3.css
    js
      0
        lib1.js
        lib2.js
      1
        lib3.js

With the following configuration in `MODULE_NAME.library_generator.yml`:

MODULE_NAME.libraries:
  css:
    base:
      dist/css/0: {}
    layout:
      dist/css/1: {}
    component:
      dist/css/2: {}
    state:
      dist/css/3: {}
    theme:
      dist/css/4: {}
  js:
    dist/js/0: { weight: -5 }
    dist/js/1: { weight: -4 }
    dist/js/2: { weight: -3 }
    dist/js/3: { weight: -2 }
    dist/js/4: { weight: -1 }

The module will scan the configured directories and generate the following
libraries:

lib1:
  css:
    base:
      dist/css/0/lib1.css: {}
  js:
    dist/js/0/lib1.js: { weight: -5 }
lib2:
  css:
    base:
      dist/css/0/lib2.css: {}
  js:
    dist/js/0/lib2.js: { weight: -5 }
lib3:
  css:
    layout:
      dist/css/1/lib3.css: {}
  js:
    dist/js/1/lib3.js: { weight: -4 }

Ask your assistant about Library Generator

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.

Activity

Tracked releases
1
Tracked since
Jun 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core PHP Release date
1.x-dev Dev 8–11 Jun 29, 2023