2 * Implements hook_page_attachments().
4 function {{ machine_name }}_page_attachments(array &$attachments) {
5 // Unconditionally attach an asset to the page.
6 $attachments['#attached']['library'][] = 'core/domready';
8 // Conditionally attach an asset to the page.
9 if (!\Drupal::currentUser()->hasPermission('may pet kittens')) {
10 $attachments['#attached']['library'][] = 'core/jquery';