# Theme components are not overriding theme CSS any more?

**URL:** https://meta.discourse.org/t/theme-components-are-not-overriding-theme-css-any-more/358989
**Category:** Development
**Created:** [March 26, 2025, 4:45pm UTC](https://meta.discourse.org/t/theme-components-are-not-overriding-theme-css-any-more/358989 "2025-03-26T16:45:48Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [March 26, 2025, 4:45pm UTC](https://meta.discourse.org/t/theme-components-are-not-overriding-theme-css-any-more/358989/1 "2025-03-26T16:45:48Z")

</div>

~~Somehow the behavior has changed in how Discourse handles CSS in theme components.~~ EDIT I did not understand what I was doing. I’m leaving this topic (in #Development instead of #Contribute > Bug) for future reference.

Very minimal example:

On Discourse 3.4.2 and tests-passed as of this morning (but this was also happening yesterday on 3.4.1)

## Main theme #1: red border around navigation container

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/f/c/cfccbe37b023a7ae6b36a6fc918908c56ed6138d.png)

## Theme component #2: blue border around navigation container

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/1/0/810f5f7638831565731f18335a60591ac69badac.png)

Theme component #2 is assigned to theme #1

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/c/4/ac462b9fcf2178ec6a7e1bd8ee1254c2085c4eb0.png)

## Expected

Blue border around navigation container

## Reality

Red border around navigation container

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/9/b/f9b2763d90550807c1655ab7c78ff3f1212cbf40.png)

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [March 26, 2025, 5:23pm UTC](https://meta.discourse.org/t/theme-components-are-not-overriding-theme-css-any-more/358989/2 "2025-03-26T17:23:09Z")

</div>

TLDR I am a fool.

Stylesheets are sorted like this

```plaintext
          if stylesheets.size > 1
            stylesheets =
              stylesheets.sort_by do |s|
                [s[:remote] ? 0 : 1, s[:theme_id] == @theme_id ? 1 : 0, s[:theme_name]]
              end
          end

```

When I tried to reproduce, I only used local stylesheets.

Reality is that stylesheets are loaded in this order:

- remote stylesheets
  - theme components, alphabetically
  - main theme

- local stylesheets
  - theme components, alphabetically
  - main theme
