Fixed CSS errors show even with Debug mode disabled (1.1.5)

Chris D

XenForo developer
Staff member
I cannot replicate this myself, but @Code Monkey reported to me that he was getting the lovely yellow and orange CSS errors on his site, because my Xen Media Gallery templates contain the use of an undefined style property @enableResponsive.

My first instinct was that debug mode was enabled, but after ensuring it wasn't enabled the ugly CSS error was still there and visible to all users. Including guests.


I believe the desired behaviour (therefore this is a bug report) is that these errors only show in debug mode (much like template errors).

Also, I think it's fair to say that the way the errors display is somewhat overkill. Even if you ARE in a development environment and you do need to see the errors, I don't feel they need to be bright orange and red and override the page background colour. I think printing them at the top of the screen like template errors is more appropriate :)

Thanks.

EDIT: I have since mitigated the errors myself, using conditionals like this:

Code:
<xen:if is="{$xenOptions.currentVersionId} >= 1020031">
    <xen:if is="@enableResponsive">
    @media (max-width:@maxResponsiveWideWidth)
    {

    }
    </xen:if>
</xen:if>
 
That was the first time I had seen that. I didn't even know it was default warning behavior. Yes it is overkill and either way it should only be displayed according to usergroup permissions IMO.
 
It is only displayed in debug mode, but if they are generated in debug mode, then caching may carry them over to other people. (And switching debug mode does not force the cache to be rebuilt.) Maybe we could switch this up a bit, though I'm not sure it should be that significant as I again stress that people shouldn't be running in debug mode in production.
 
When it was first reported to me, I couldn't see any CSS errors. Then I went between a couple of pages (as a guest) and it appeared.

I said the same. It only appears in debug, switch debug off. But then it transpires that debug was only running for @Code Monkey's IP address.

But I guess that must mean that ultimately debug mode is still enabled.
 
It seems to me that if debug is only enabled for an IP then only someone connecting from that IP should see any output resulting from debug mode being on. While you are correct that debug shouldn't be run on a production site, there are always times when there is a need to do so.

And it still showed when debug was off.
 
I've adjusted the CSS cache system (in 1.2) to distinguish the cache for debug and no debug which should prevent the issue from moving over to other users if the cache is generated by a user in debug mode.

Note that this doesn't affect browser caching. Flipping debug mode on and off won't force the CSS cache to be updated in your browser cache - you would need to do a hard refresh.
 
Great, thanks.

Any thoughts on making the error much more subtle than it is now?

A bit of error text at the top of the page is just about acceptable if you're in a situation where debug mode HAS to be on - even for a few seconds - but taking over the entire background with the bright colours seems a little bit over the top.

Even as a developer who appreciates the importance of being alerted to template and CSS errors, I would still see the error if the background colour didn't change to yellow :)
 
Back
Top Bottom