Libraries are not loaded from subdirectories, while modules and themes could be loaded from subdirs . I believe it should be unified.

Example:

sites/site_name/libraries/library - library loaded
sites/site_name/libraries/subdir/library - library did not loaded

Comments

aroq created an issue. See original summary.

tstoeckler’s picture

Status: Active » Closed (won't fix)

At the moment, this is not something we can reasonably support. Because libraries can have arbitrary directory structures, we really cannot know when to stop recursing into directories.

I.e. If a library has a 'lib' dir and a 'src' and an 'img' dir, we could have the following structure:
- sites/site_name/subdir/library
- sites/site_name/subdir/library/lib
- sites/site_name/subdir/library/src
- sites/site_name/subdir/library/img

How do we now that 'library' is a library but e.g. 'img' is not?

Also, I'm not sure if there is a concrete requirement for this. It would be nice -sure - but it's not really possible ATM.

Feel free to re-open if I'm missing something.

mvonfrie’s picture

I think an unlimited depth is not needed, but one level would be enough. If we look at the Composer directory structure vendor/[vendor-name]/[library-name] we could see this similar and treat the libraries directories as vendor directory. With one level of subdirectories we are able to implement the vendor/library naming scheme like Composer does.

My current use case is a grown Drupal 7 site where I need one PHP library which is available via Composer and has no dependencies (https://github.com/cweiske/jsonmapper). This would allow me to put the library into sites/all/libraries/cweiske/jsonmapper and create the library definition with the machine name cweiske/jsonmapper and keeping the naming scheme.