Score:0

Disabling (or overriding) a css file from contrib module's library

in flag

I am using admin_toolbar module and I would like to override the path to a logo file that is by default provided by one of this module's CSS file.

I found information that I can achieve this with libraries-override in my theme.info.yml file.

The problem is that the file seems to be still loaded when I check the page source.

The file that defines the path to a logo file is located in:

/modules/contrib/admin_toolbar/admin_toolbar_tools/css/tools.css

And my theme.info.yml file looks like this:

name: Custom Olivero Theme
type: theme
description: 'Custom Olivero Theme.'
package: Custom Themes
core_version_requirement: ^8 || ^9
libraries:
  - custom_olivero/global-styling
base theme: olivero
libraries-override:
  admin_toolbar_tools/toolbar.icon:
    css:
      theme:
        /modules/contrib/admin_toolbar/admin_toolbar_tools/css/tools.css: false

Can you please share any suggestions on what am I doing wrong or, if this approach is not following the good Drupal practices, suggest what is the better way of achieving the same result?

Score:2
us flag

The content of the admin_toolbar_tools.libraries.yml file is the following.

toolbar.icon:
  css:
    theme:
      css/tools.css: {}

You remove that file with the following override.

libraries-override:
  admin_toolbar_tools/toolbar.icon:
    css:
      theme:
        css/tools.css: false

You do not need to use the full file path, but the path used in the .libraries.yml file for that module.

Adamssef avatar
in flag
Thank you. Changing the path worked!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.