XF 2.2 Using style properties in a template conditional

Lee

Well-known member
If I wanted to use a style property in a template conditional what is the correct way to reference it?

As a side note, is using template conditionals in css/less templates possible and/or recommended practice?
 
Solution
Thanks Brogan.

What is the correct method to include a less template and have it parse as css? :)

Hi @Lee
I can reply briefly. More details maybe will be adding by @Brogan
Create your.less template put it the your codes and include your less template with use the following;

<xf:css src="your.less"/>

or use the

<xf:css>your css codes</xf:css>

That's all.
Standard XF conditional statements don't work in less templates.

What are you trying to do?

Style properties can be called in templates using {{ property('propertyName') }}.
 
Trying to apply some CSS to an element depending on what conditions are selected in style properties.

I want to enable / disable a menu.

I was trying to stop the CSS loading in the less templates if it isn't required.

I think what I will do is wrap the HTML in a conditional and then put the less in its own template and wrap that template include in a conditional.

Unless there is a better way to achieve this? :)
 
Thanks Brogan.

What is the correct method to include a less template and have it parse as css? :)

Hi @Lee
I can reply briefly. More details maybe will be adding by @Brogan
Create your.less template put it the your codes and include your less template with use the following;

<xf:css src="your.less"/>

or use the

<xf:css>your css codes</xf:css>

That's all.
 
Solution
Top Bottom