# Plugin CSS takes priority over theme CSS?

**URL:** https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828
**Category:** Support
**Created:** [March 19, 2020, 2:15pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828 "2020-03-19T14:15:07Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [March 19, 2020, 2:15pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/1 "2020-03-19T14:15:07Z")

</div>

My theme cannot override my plugin CSS because it’s loaded before the plugins. Is this a bug or a permanent change (2.4.1)?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [March 19, 2020, 3:15pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/2 "2020-03-19T15:15:36Z")

</div>

Hmm yes, you’re right. We load core, then themes, then plugins

> <https://github.com/discourse/discourse/blob/main/app/views/common/_discourse_stylesheet.html.erb#L11-L17>

I think core → plugins → themes would be a better order, and would match the pre-[plugin-debundling](https://github.com/discourse/discourse/commit/5bd6b70d985e2736f56d2bec6cce56bee0227b1f#diff-b7cd0bbfe681e2c8d48db57817e9d6b5) behaviour. What do you think @awesomerobot @Johani @jordan.vidrine?

@WorldIsMine a workaround is to increase the [specificity](https://www.w3schools.com/css/css_specificity.asp) of theme’s CSS.

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [March 19, 2020, 3:28pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/5 "2020-03-19T15:28:42Z")

</div>

Yeah that sounds like a better order to me too!

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [March 19, 2020, 3:30pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/6 "2020-03-19T15:30:31Z")

</div>

Prior to 2.4 applying changes to theme CSS worked, so is this considered an unintentional bug?

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [March 19, 2020, 3:31pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/7 "2020-03-19T15:31:27Z")

</div>

> [@david](#):
>
> @WorldIsMine a workaround is to increase the [specificity](https://www.w3schools.com/css/css_specificity.asp) of theme’s CSS.

Thank you, I will look into this.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [March 19, 2020, 3:37pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/8 "2020-03-19T15:37:14Z")

</div>

> [@WorldIsMine](#):
>
> Prior to 2.4 applying changes to theme CSS worked, so is this considered an unintentional bug?

Plugin CSS used to be all bundled up together, and loaded after the core stylesheets. So yes, this is an unintentional side-effect of us debundling it. I think we can backport this fix to stable, it is very low risk. I don’t think anyone will be relying on this behaviour.

Opened a PR here:

[https://github.com/discourse/discourse/pull/9240](https://github.com/discourse/discourse/pull/9240)

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [March 19, 2020, 4:16pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/9 "2020-03-19T16:16:30Z")

</div>

When is a realistic time frame when this change will go into effect? I have lots plugins on my instance and spend the last two days upgrading things so they’re compatible with 2.4.1 and this is the only nuisance keeping me from upgrading 😃

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [March 19, 2020, 4:17pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/10 "2020-03-19T16:17:10Z")

</div>

I just merged it to master, planning to backport to beta and stable in the next hour (unless there are issues) 🙂

(Edit: bit delayed due to some unrelated test issues, but will get it backported ASAP)

---

<div class="post-metadata">

### Author: ![WorldIsMine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/worldismine/32/455660_2.png) [@WorldIsMine](https://meta.discourse.org/u/WorldIsMine)
#### Post date: [March 19, 2020, 4:22pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/11 "2020-03-19T16:22:05Z")

</div>

You guys rock! \<3 Thank you very much for the quick support.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [March 19, 2020, 7:26pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/12 "2020-03-19T19:26:04Z")

</div>

Took a little longer than planned, but that’s done on [stable](https://github.com/discourse/discourse/commit/0e3dfd2925688ffad136d8a54d1def0ac970d60e), [beta](https://github.com/discourse/discourse/commit/ebb0b94f730799b5683a228e738494c7c8829d2e) and [tests-passed](https://github.com/discourse/discourse/commit/22d5ba0f77a7c19188ef5d16c4fee89a88ea0407). Head to `/admin/upgrade` and update to the latest version to get the fixed behaviour.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [April 18, 2020, 7:26pm UTC](https://meta.discourse.org/t/plugin-css-takes-priority-over-theme-css/144828/13 "2020-04-18T19:26:09Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
