In Drupal 8, when I declare a library in a .libraries.yml
file, it seems the library files have to be located INSIDE the module or the theme folder with the .libraries.yml
file.
For instance, if a MYMODULE module contains this .libraries.yml
file:
form-alter-css:
version: 1.x
css:
theme:
css/form-alter.css: {}
The file css/form-alter.css
has to live at DRUPAL_ROOT/modules/MYMODULE/css/form-alter.css
.
Instead, for shared libraries, I'd like to place the files in DRUPAL_ROOT/libraries
, like we did in Drupal 7. But how?
I have tried entering an absolute path in the .libraries.yml
file (e.g. /libraries/css/form-alter.css
) but it doesn't work. Any ideas?