XF 2.1 v2.1.4 variable bug

Dynamic

Well-known member
Hi guys,

I'm not sure when this problem occurred, but I noticed it after updating to v2.1.4. So, this is what is happening.

extra.less has the following within it

Code:
<xf:include template="Colors.less" />

Colors.less has the following within it

Code:
@Dark: #333333;

So, when I create a templates less file, I can use @Dark to define a colour for whatever it is I want, and the colour will be #333333. This has been working without an issue up until recently. Since upgrading (I believe) to 2.1.4, everything works perfectly. However, if I create a new template, and use the variable @Dark, it throws an error. The error is

Code:
     XF\CssRenderException: Error rendering template public:newTemplate.less: variable @Dark is undefined in file public:newTemplate.less in public:newTemplate.less (on or near line 3331) src/XF/CssRenderException.php:87

It is very strange and I can't figure out what is causing the issue. All templates that were created prior to the upgrade seem to not have this issue.

@Aayush has also seen this problem.

Thanks.
 
There wouldn’t have been any changes in the Less rendering for a considerable amount of time.

I think this may be expected if, for example, your new template is loaded before extra.less.

You may need to include the CSS in a template which is loaded sooner, such as core.less. Note we also don’t use <xf:include> to include less. I don’t think it will exactly make a difference here, but worth keeping it similar to our approach that you will see in core.less.
 
There wouldn’t have been any changes in the Less rendering for a considerable amount of time.

I think this may be expected if, for example, your new template is loaded before extra.less.

You may need to include the CSS in a template which is loaded sooner, such as core.less. Note we also don’t use <xf:include> to include less. I don’t think it will exactly make a difference here, but worth keeping it similar to our approach that you will see in core.less.

Hi Chris,

I added the files the same way as in core.less

{{ include('Colors.less') }}

It did not make a difference. This was all working without an issue, and now it is not. Could there be a server setup error, as we did move servers around the same time.

Thanks.

EDIT:

There is also another issue. If I take a template that includes a .less file, and I change the .less file to another one, even if the new .less file is an exact copy it too throws an error.
 
Top Bottom