I am having difficulties to change the library path defined by another module in *.libraries.yml via hook_library_info_alter

Essentially I have one module defining a library component in its *.libraries.yml like that:

# Font Awesome
  version: 4.7.0
      /libraries/fontawesome/css/font-awesome.min.css: {minified: true }

How has my hook to look like to change to path to:


Thanks for helping me!


I pushed my patch for social icons module to add dynamic font awesome css here https://www.drupal.org/project/social_icons/issues/2984954

This is helpful to you.

if (isset($libraries['font-awesome'])) {
     $library_key = key($libraries['font-awesome']['css']['theme']);
     $library_array = $libraries['font-awesome']['css']['theme'][$library_key];
     $libraries['font-awesome']['css']['theme'][$font_awesome_url] = $library_array;

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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