This thread is confusing
It is not possible to check screen size via
<xf:if>
as this is executed on the server which technically
never can know the current screen size used on the client.
LESS / CSS in XenForo
are templates (not files!) and can use all templater features (like conditionals). As those templates are not rendered for each client request (the output is cached on both client and server), conditionals in LESS / CSS templates can usually only be used to check style properties.
Depending on the usecase, media queries can be used for conditionally executing JavaScript
Code:
<xf:js>
if (window.matchMedia('screen and (min-width:400px)').matches)
{
alert ('Screen width is at least 400px');
}
</xf:js>
Using this approach it is also possible to load external JavaScript files based on media query results.