3

This is a follow up to Define JavaScript library in Drupal 8

I have a third party library that I don't want to bundle with a module. In Drupal 7 I could just ask the user to extract to sites/all/libraries what is the best practice in Drupal 8?

2 Answers 2

1

One option is to do it exactly like in D7. Put it in /libraries or /sites/all/libraries and use the libraries module to detect the location.

location.module itself unfortunately doesn't work that well in 8.x yet, so you have to define an 8.x-1.x library and then use the libraries API to get the location and dynamically alter. Or I guess you could also do that part yourself.

I'm doing that in the JW Player project, see jw_player_libraries_info() + jw_player_library_info_alter(). It unfortunately still requires a bit of code, maybe that will improve in the future when libraries.module works better in 8.x.

1
  • I think this is the closest to an answer I'll find at the moment, fwiw I'm going with /libraries and will provide drush integration to download the file.
    – digital
    Commented Jul 14, 2015 at 10:30
0

If we follow what symfony2 uses, we have to use then: /vendor/libraryname/lib/Libraryname/src/libraryname.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.