Custom CSS not always picked up in Admin


(James Cook) #1

I’ve noticed an issue where custom css isn’t picked up if you load the admin page directly or click a link to it that refreshes the page.

I got a message saying there were problems with my installation. When I click the link http://forumurl.com/admin in that message the custom css is not loaded for the admin page.

I can reproduce this by just going to http://forumurl.com/admin in my browser.

I’ve noticed this issue before on a different installation of Discourse but never had the time to investigate what was causing the issue.

Can anybody else reproduce this issue? My custom CSS at the moment is only affecting the header so it may be restricted to that.


(Rafael dos Santos Silva) #2

This is a feature.

CSS customizations aren’t applied on the admin pages, so you can’t shoot yourself in the foot by making it inaccessible with bad CSS and JS.


(James Cook) #3

I can understand with JS, but CSS?

It would be nice to have the option to allow this (for CSS only) for those of us that want our admin section to look like the rest of the site.


(Rafael dos Santos Silva) #4
body {
    display: none;
}

(Mittineague) #5

Yes, both.

Search here for older topics like “I can’t access my Admin” and you’ll understand way this is a good default.

Once you understand Discourse code well enough to style the Admin pages differently than they are, it can be assumed that there is a much better chance you won’t cause a major FAIL.

In any case, my question is a big why?

How many will see the Admin pages and why should they care if they look like Admin pages?


(James Cook) #6

It’s not a big deal, I guess it just bugs me and as I’m not going to be doing anything crazy in there it would be nice to have that option.

Is there anyone on here who actually did the following?

body {
    display: none;
}

I assume the above is worst case scenario for CSS, and even then all it takes is to open up Chrome inspector and change it to access the page. That’s why I can’t really understand the need to protect against CSS changes here. In my opinion it’s being a little too careful.


(James Cook) #7

Actually, another reason (apart from it bugging me) is that moderators can access the admin pages. It looks amateurish if my admin pages are obviously different to the rest of the site. Again, I’ll reiterate that I believe this should be a decision for site owners to make.


(Rafael dos Santos Silva) #8

(Mittineague) #9

But Admin pages are different.

How many of your Moderators have complained?

Discourse is open source, there is nothing stopping you from over-riding this behavior if you feel strongly enough about it.


(James Cook) #10

Fair enough. I just wasn’t aware of the context surrounding this.