Score:-1

How to add CSS for a sub theme?

cn flag

I have a sub theme I created this way:

globalrs/globalrs.info.yml

name: globalrs
type: theme
core_version_requirement: ^8 || ^9
description: globalrs
base theme: tara
libraries:
  - globalrs/global-styling

globalrs/globalrs.libraries.yml

global-styling:
  css:
    component:
      css/style.css: {}

globalrs/style/style.css

* {
    background: red !important;
}

The sub theme was set to default but still nothing has a red background (after flushing browser cache). What have I done wrong?

Score:1
cn flag

According to the documentation, you want to use theme instead of component:

global-styling:
  css:
    theme:
      css/style.css: {}

Also note in addition to flushing the browser cache, you should rebuild the Drupal cache.

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.