- Affected version
- 2.2.4
Code:
<xf:if is="property('metaThemeColor')">
<meta name="theme-color" content="{{ parse_less_color(property('metaThemeColor')) }}" />
</xf:if>
This code in template
PAGE_CONTAINER
seems to trigger kinda inefficient code:\XF\Template\Templater::fnParsLessColor()
does instantiate a full CSS renderer which in turn does load lessphp.
PHP:
public function fnParseLessColor($templater, &$escape, $value)
{
/** @var \XF\CssRenderer $renderer */
$rendererClass = $this->app->extendClass('XF\CssRenderer');
$renderer = new $rendererClass($this->app, $this);
$renderer->setStyle($this->style);
return $renderer->parseLessColorValue($value);
}
All in all this does load ~ 20 additional files, which seems a bit much for just converting a CSS color to
#Hex
format.IMHO it would be a lot more efficient to prepare the value when saving the style and just using that prepared value at runtime.
This should not cause any side effects as colors could already be in
#Hex
format anyway.
Last edited: