## Example Library In a module.libraries.yml file. ``` dashboard: js: js/dashboard.js: {} dependencies: - core/drupal - core/jquery ``` ## Adding Libraries ### In preprocess function or controller function. ``` $variables['#attached']['library'][] = 'lotus/lotus-js'; ``` ### In twig template file. ``` {{ attach_library('hcpl_zen/title-record') }} ``` ### In a view (pre render hook). ``` $view->element['#attached']['library'][] = 'custom/custom_view'; ``` ## Miscellaneous ### Overriding libraries ``` // Libraries is an array of the library data. // Extension is 'core' or the module/theme that defined the libraries. function hook_library_info_alter(&$libraries, $extension) ```