2 * Implements hook_library_info_build().
4 function {{ machine_name }}_library_info_build() {
6 // Add a library whose information changes depending on certain conditions.
7 $libraries['mymodule.zombie'] = [
12 if (Drupal::moduleHandler()->moduleExists('minifyzombies')) {
13 $libraries['mymodule.zombie'] += [
15 'mymodule.zombie.min.js' => [],
19 'mymodule.zombie.min.css' => [],
25 $libraries['mymodule.zombie'] += [
27 'mymodule.zombie.js' => [],
31 'mymodule.zombie.css' => [],
37 // Add a library only if a certain condition is met. If code wants to
38 // integrate with this library it is safe to (try to) load it unconditionally
39 // without reproducing this check. If the library definition does not exist
40 // the library (of course) not be loaded but no notices or errors will be
42 if (Drupal::moduleHandler()->moduleExists('vampirize')) {
43 $libraries['mymodule.vampire'] = [
45 'js/vampire.js' => [],