XF 2.1 Why are pageWidth and pageInset mixins not in setup.less?

Ian Hitt

Well-known member
Why are pageWidth and pageInset mixins not in setup.less? They are in app.less instead. Before XF2.1 I think pageWidth was in setup.less, so why the change? I am running into this issue when including css via xf:css directly in the template with the markup so as to not load the CSS unnecessarily.
 
Those have always been in app.less in XF 2 (both 2.0 and 2.1). I checked as far back as my development servers will go (2.0.5).

EDIT: Also, I don't think pageInset existed in 2.0. At least I can't find it.
 
Last edited:
Those have always been in app.less in XF 2 (both 2.0 and 2.1). I checked as far back as my development servers will go (2.0.5).

EDIT: Also, I don't think pageInset existed in 2.0. At least I can't find it.

Yeah pageInset is new to 2.1. Not sure why these wouldn't be globally available though.
 
Simply because they are only used on the front side so they are specific to the public app.less.

Either that or they exist in both but do different things or require different code (I forget and on mobile at the moment).
 
I believe pageWidth was in setup.less before, so it could have been in both. In either case though they seem like being globally available would be more correct? I will say that I ran into a very very small use case issue, in that I was attempting to load app_staffbar.less only when there was a staffbar present by using <xf:css inside the contentcheck in PAGE_CONTAINER. I was just testing the ability to split up some of the main CSS that's not always needed. But doing so changes the order so that staffbar loads before app.less and therefore missing the pageWidth and pageInset mixins.
 
I believe pageWidth was in setup.less before
In case I wasn't clear in my last message, no, it wasn't. It has always been (and only ever been) in app.less. Now I'm back on my laptop I can confirm there is a m-pageWidth mixin in both public/app.less and admin/app.less.

They are not appropriate to be globally available because they contain different code depending on whether it's the admin or public style, and they will remain in their respective places.
 
I believe I already know the answer, but there is not a way to defer xf:css calls until the end is there? So I could ensure that using xf:css the file would load after app.less?
 
There isn't, unfortunately.

You mentioned earlier that your intention was to just split up some of the app specific stuff. By default app.less (which includes all of the other app_* templates for reasons like this - app.less contains dependent code so they need to be in the same css.php call) is only 6KB so I'm not sure you're going to be able to optimise much by splitting things up.
 
@Chris D Specifically what I was trying to do was to stop loading app_staffbar.less when there is no staffbar on the page (and other similar items like app_breadcrumb.less). Google complains that most page only use around 85% or so of the CSS that's being loaded, and much of that is unavoidable because we on't always know what content the page will have (especially with widgets), but I figured I could try and remove some of the CSS that I know for certain will not be on the page by putting the CSS calls inside the macros (such as is done with node_list.less).
 
Back
Top Bottom