While talking to @webchick at BADCamp, I (samuel.mortenson) brought up that even with Drupal 8's new Library handling logic, there is still no answer to/best practice for one of the most common Library problems: "Where do I put my external Javascript/CSS files?". I can think of a few approaches to this, but we should standardize as a community on one or more best practices so that contributed module authors know the best methods for handling external libraries.
The stories that need to be worked out in the documentation are:
drupal_add_js()
and drupal_add_css()
. Now, Drupal 8 uses a [my_module].libraries.yml
file as a suitcase of assets.Ultimately, the goal of the Libraries API is to make the assets added by it shareable between modules and themes, consistently done between projects and developers/sitebuilders — and it is easier to maintain through the lifespan of a site.
DRUPAL_ROOT/libraries
as the general folder to uncompress those packages. Use a subfolder name reflecting that JS framework/plugin (e.g., /libraries/jquery.easing
).DRUPAL_ROOT is the PHP Constant name for your web root folder where the other files (like index.php) would be found.
DRUPAL_ROOT/sites/[domain]/libraries
.[my_module].install
file in your module. Use hook_requirements($phase) with a loop for if ($phase=='install'){}
to check for proper installation of Library.RE: Regarding Software Licenses. Drupal.org's policies and other legal requirements
Simply, if we use the Libraries API (and only include the JS behaviour and custom CSS in our modules/themes) we will be in compliance with such policies and laws. Making such 3rd code sharable and maintainable in our custom work for clients. As well as then being ready to contribute work back to the Drupal Community.
Active
Missing documentation
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.