XF 2.2 Rebuild Template Cache

Ozzy47

Well-known member
In an addon I'm working on, I have this in a.less file:
CSS:
<xf:if is="property('ozzmodz_fm_mobile') == 'no'" >   
    @media (max-width: @xf-responsiveMedium)
    {
        display: none;
    }
</xf:if>

Now the only way to get that style property to apply to the template when I change it from yes to no is to save the .less template.

I seem to remember coming across this before,and there was a way to rebuild the template/cache to apply the changes to the style property.
 
The general recommendation would be to add a class conditionally in a template instead:

HTML:
<div class="your-thing {{ property('ozzmodz_fm_mobile') == 'no' ? 'your-thing--hidden' : '' }}">

CSS:
.your-thing--hidden
{
    @media (max-width: @xf-responsiveMedium)
    {
        display: none;
    }
}

Edit: Though I think changing property values should cause a CSS update already, so this tends to be more useful for other types of conditions. I'm not sure why that wouldn't be the case here.
 
Last edited:
Though I think changing property values should cause a CSS update already, so this tends to be more useful for other types of conditions
Changing a style property must invalidate rendered CSS, otherwise the change could not become active.

Therefore it shouldn't matter if a style property is used as a condition or as a plain value.
 
Yep, just wasn't 100% sure off-hand if there was some edge case that prevented that from working here.
 
Top Bottom