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

JohnAlbin created an issue. See original summary.

JohnAlbin’s picture

Component: PHP/JS code » Component markup (CSS/Sass/HTML/Twig)

Alternatively, have the components module auto-register libraries.

JohnAlbin’s picture

Component: Component markup (CSS/Sass/HTML/Twig) » PHP code
Related issues: +#2707849: Allow components to define asset libraries
JohnAlbin’s picture

Not 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...