Hi,
having a common remote registry for libraries makes sense for generic libraries used in more than one extension, but sometimes a specialized library is used only by one drupal extension and it would be handy if that extension could control the library definition by itself.
Using public:://library-definitions is handy during the development phase but it seems to me that location is intended to be populated manually by the developer for modules not in the registry, and not automatically by modules when they are downloaded.
So what about allowing extensions to provide their own library definitions? For example they could have a library-definitions/ subdirectory containing library definitions. That would allow more flexibility in updating the definitions, skipping the "bureaucracy" of the central registry when it's not really needed.
For example I would use that mechanism for the Drupal Syntax Highlighter module which uses the SyntaxHighlighter Javascrpt library.
Right now I am avoiding the global registry using a "package" repository snippet added to the root composer.json file to download the external library, defining the drupal assets in syntaxhighlighter_library_info_build(). but I'd prefer to switch to a native way.
I also consider this issue somehow related to #2774313: Validate library dependencies when extensions are installed and more gracefully deal with library-specific errors at runtime, towards the goal of making modules self-sufficient wrt. libraries.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Support-per-module-library-definitions-2887738-3.patch | 1019 bytes | ao2 |
Comments
Comment #2
ao2 commentedfix a typo
Comment #3
ao2 commentedHere is an experimental patch to show the idea.
This allows an extension to have its own
library-definitionsdirectory.