In my subtheme, I want to override the layout builder's CSS library, I tried the following :

libraries-override:
  layout_builder/twocol_section:
    css:
      theme:
        layouts/twocol_section/twocol_section.css: css/layout_builder/layouts/twocol_section/twocol_section.css
  layout_builder/threecol_section:
    css:
      theme:
        layouts/threecol_section/threecol_section.css: css/layout_builder/layouts/threecol_section/threecol_section.css

but (after clearing the cache) that didn't work.

what am I doing wrong ?

Comments

wombatbuddy’s picture

What is your base theme? Check whether these libraries have been overridden previously in the base theme.

drupaldope’s picture

ah thanks!

it's this old issue again:
https://www.drupal.org/project/drupal/issues/2642122

silly me, I even forgot I wrote a reminder about it
https://drupaldope.com/drupal-9-tricks/drupal-themeing-overriding-librar...

nice brain fail on my part, thank you for the pointer !

Coop920’s picture

EDIT.

Got this working.  This is the important line to note if you're overriding the css with your own.

Path to the css file on the left (from the subtheme) and path to YOUR css file on the right.

theme:
        /core/themes/stable/css/contextual/contextual.theme.css: css/overrides/contextual.theme.css
drupaldope’s picture

this part of themeing is really tricky

arnoldmatt700’s picture

Looks like there might be a typo in your libraries-override for the layout builder. The second path under theme should likely point to your actual CSS file, not the core layout builder CSS again. Try this:

libraries-override:
  layout_builder/twocol_section:
    css:
      theme: layouts/twocol_section/your_twocol_section.css
  layout_builder/threecol_section:
    css:
      theme: layouts/threecol_section/your_threecol_section.css

Remember to replace your_twocol_section.css and your_threecol_section.css with the actual filenames of your override styles.