I have a custom Drupal module and I would like to enqueue its CSS to the administrator side. I’ve tried to add it to the .info.yml file.
css: theme: admin-styles.css: {}
I also implemented hook_page_attachments()
in the module as described in Custom module for adding CSS file in admin section.
function admin_css_page_attachments(array &$attachments) { $is_admin = Drupal::service('router.admin_context')->isAdminRoute(); if ($is_admin) { $attachments['#attached']['library'][] = 'admin-styles.css'; } }
I still don’t see the CSS file in the source code of the administrator panel.