Plugin CSS takes priority over theme CSS?

AI-generated summary

The discussion revolves around a change in CSS loading order in Discourse 2.4.1, where plugin CSS now takes priority over theme CSS, causing issues for users trying to override plugin styles. WorldIsMine reports that this behavior is a regression, as it previously worked correctly. david confirms it’s an unintended side-effect of plugin debundling and proposes reordering the loading sequence (core → plugins → themes) to restore the previous behavior. The community agrees this is a better order, and awesomerobot supports the change. david merges a fix and backports it to stable, beta, and tests-passed branches. WorldIsMine thanks the team for the quick resolution. Users are advised to update via /admin/upgrade to get the fix.

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)?

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

I think core → plugins → themes would be a better order, and would match the pre-plugin-debundling behaviour. What do you think @awesomerobot @Johani @jordan.vidrine?

@WorldIsMine a workaround is to increase the specificity of theme’s CSS.

Yeah that sounds like a better order to me too!

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

Thank you, I will look into this.

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

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 :smiley:

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

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

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

Took a little longer than planned, but that’s done on stable, beta and tests-passed. Head to /admin/upgrade and update to the latest version to get the fixed behaviour.