Provide an easy method for supplying a custom css file to Claro

Created on 5 September 2020, over 4 years ago
Updated 21 February 2025, about 2 months ago

Problem/Motivation

It is sometimes desirable to make minor css changes to a core admin theme. To do this, usually means creating a sub-theme or using a contrib module such as Asset Injector or CSS Editor .

These approaches seem a big effort, if all that is needed is a minor css modification.

Proposed resolution

It would be helpful to have a method of supplying a css file to the Claro theme, so that minor css changes can be managed without the use of subtheme or contrib modules. This should be done in such a way that is compatible with core updates.

Briefly, this involves insert the following code in to claro.libraries.yml and then referencing this as a library in claro.info.yml

custom-styling:
  version: VERSION
  css:
    theme:
      public://claro/custom.css: {}

A similar solution has existed for Adminimal Theme for some time.

Over time this could be developed into a more robust feature, but in the meantime a very small patch could provide most of the necessary functionality.

Remaining tasks

- Create a patch
- Provide documentation
- Backport to Seven admin theme

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

To do

Feature request
Status

Closed: won't fix

Version

9.4

Component

Claro theme

Created by

🇬🇧United Kingdom mrpauldriver

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States bwoods

    I've created a new patch to account for some cleanup done on Claro in D10.

    My use case for this patch had to do with the usability of the Layout Paragraphs module. I suppose I could have written a patch simply for the styles I wanted to target, but I thought I would try this patch in case I needed to make additional adjustments. I agree with @justafish somewhat in that perhaps a small custom module would be a better option for this, primarily because the stylesheet wouldn't be versioned if it's stored in the public files directory.

Production build 0.71.5 2024