5

Created a dynamic library which attaches some external CSS & JS thru hook_library_info_build hook and this depends on a dynamic config values set by a config form. So whenever that config form saved, how can I make sure the library info is up to date and latest? and users don't have to always do a complete cache rebuild.

Additionally is it possible to clear(or rebuild) just one library definition?

1 Answer 1

2

Okay, searching thru core services found this. We can clear all the library definitions like this.

\Drupal::service('library.discovery')->clearCachedDefinitions();

See Drupal Reference of this method: Reference

Calling this function Clears static and persistent library definition caches.

Your Answer

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

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