Hello, how to add JS, CSS (libraries) to admin panel, on pages ?

I don find any opportunities to do this

Comments

lincolnbergeson’s picture

Drupal sites use a different theme for the frontend and the backend.

Go to http://yoursite.com/admin/appearance to see which theme is the "default theme" (frontend) and which is the "administration theme" (backend). In my case, "Seven" is the administration theme, and controls what the admin pages look like.

You can add CSS directly by adding files into core/themes/your-admin-theme and adding entries in the corresponding theme.libraries.yml.

Adding CSS directly to a core theme, however, is not recommended, because updating your theme will cause those changes to be erased. So you should consider adding a sub-theme. More information here: https://www.drupal.org/docs/8/theming-drupal-8/creating-a-drupal-8-sub-t...

If it is the case that you just want to add some css to the WYSIWYG, there is a specific API for that. Instructions here: https://www.drupal.org/node/2674412

So it may be the case that whatever component you want to customize has its own way of adding extra CSS.