Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When every component is going to need its own library, that's going to make for one really, really long THEMENAME.libraries.yml.
What if we made a gulp task that automated this?
Phase one:
Every component has its own component.libraries.yml file and the gulp task aggregates them all into THEMENAME.libraries.yml.
Phase two:
If the only thing the component is wanting to add as a library asset is the CSS, then the gulp task could automatically figure out the syntax needed for the library YML and add it automatically.
If the component needs JS, they would need to write the libraries.yml by hand.
Comments
Comment #2
JohnAlbinAlternatively, have the components module auto-register libraries.
Comment #3
JohnAlbinSee #2707849: Allow components to define asset libraries
Comment #4
JohnAlbinNot sure if this will work, but here's an interesting thing about including yml files in yml files. https://stackoverflow.com/questions/528281/how-can-i-include-an-yaml-fil...