XF 2.2 How to Properly Modify CSS Files?

Dkf

Active member
Hello everyone,
Here's the situation - I don't edit CSS templates directly but create a "template modification."
I do everything correctly and simply, for example:
Find: min-height: 260px;
Replace with: min-height: 400px;

After I activate this, the main page of the forum completely loses its CSS layout, turning into a jumble of words. In the forum console, I get tens of thousands of errors per minute of approximately the following content:

Code:
Server error log
ErrorException: [E_DEPRECATED] Creation of dynamic property Less_Tree_Variable::$parensInOp is deprecated src/vendor/oyejorge/less.php/lib/Less/Parser.php:2466
Generated by: Unknown account 01.07.2024 at 12:37
Stack trace
#0 src/vendor/oyejorge/less.php/lib/Less/Parser.php(2466): XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/home/www...', 2466)
#1 src/vendor/oyejorge/less.php/lib/Less/Parser.php(858): Less_Parser->parseAddition()
#2 src/vendor/oyejorge/less.php/lib/Less/Parser.php(2567): Less_Parser->MatchFuncs(Array)
#3 src/vendor/oyejorge/less.php/lib/Less/Parser.php(2364): Less_Parser->parseExpression()
#4 src/vendor/oyejorge/less.php/lib/Less/Parser.php(858): Less_Parser->parseValue()
#5 src/vendor/oyejorge/less.php/lib/Less/Parser.php(2064): Less_Parser->MatchFuncs(Array)
#6 src/vendor/oyejorge/less.php/lib/Less/Parser.php(858): Less_Parser->parseRule()
#7 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1009): Less_Parser->MatchFuncs(Array)
#8 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1938): Less_Parser->parsePrimary()
#9 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1723): Less_Parser->parseBlock()
#10 src/vendor/oyejorge/less.php/lib/Less/Parser.php(858): Less_Parser->parseMixinDefinition()
#11 src/vendor/oyejorge/less.php/lib/Less/Parser.php(1009): Less_Parser->MatchFuncs(Array)
#12 src/vendor/oyejorge/less.php/lib/Less/Parser.php(674): Less_Parser->parsePrimary()
#13 src/vendor/oyejorge/less.php/lib/Less/Parser.php(621): Less_Parser->GetRules(NULL)
#14 src/vendor/oyejorge/less.php/lib/Less/Parser.php(449): Less_Parser->_parse()
#15 src/XF/CssRenderer.php(414): Less_Parser->parse('// Note that th...')
#16 src/XF/CssRenderer.php(352): XF\CssRenderer->renderToCss('public:account_...', '// Note that th...')
#17 src/XF/CssRenderer.php(260): XF\CssRenderer->renderTemplate('public:account_...', NULL)
#18 src/XF/CssRenderer.php(118): XF\CssRenderer->renderTemplates(Array, Array, Array)
#19 src/XF/CssWriter.php(55): XF\CssRenderer->render(Array)
#20 css.php(30): XF\CssWriter->run(Array, 2, 2, 'cfff79c8ce53b9a...')
#21 {main}
Request state
array(4) {
  ["url"] => string(191) "/css.php?css=public%3Aaccount_security.less%2Cpublic%3Anotices.less%2Cpublic%3Asiropu_ads_manager_ad.less%2Cpublic%3Aextra.less&s=2&l=2&d=171982729&k=cfff79c8ce53b9a"
  ["referrer"] => string(45) "https://www.domain.com/account/security"
  ["_GET"] => array(5) {
    ["css"] => string(100) "public:account_security.less,public:notices.less,public:siropu_ads_manager_ad.less,public:extra.less"
    ["s"] => string(1) "2"
    ["l"] => string(1) "2"
    ["d"] => string(10) "1719729"
    ["k"] => string(40) "cfff79c8ce53b9a..."
  }
  ["_POST"] => array(0) {
  }
}

What am I doing wrong?

XF 2.2.13
 
Last edited:
Is it possible the min-height is occurring multiple times, so you are targeting more than just the one you want? Or could it be you are trying to target something that is inline style?

I understand your reasons for attempting this with a template modification, but I would do this by adding the new CSS to extra.less template. A lot easier to troubleshoot IMO
 
Last edited:
Or could it be
Why not in the extra.less?
I know you are asking DKf so please excuse me for jumping in. I can see their reasoning behind a template modification, ie instead of two bits of code (the original and the extra - one overriding the other), there is just one bit of code as it is a replacement.

But for such a small thing as a min-height I think it creates more potential headaches than it solves.
 
You're running XF 2.2.13 on PHP 8.2+, which is not fully supported. XF 2.2.14+ has better support for PHP 8.1 and PHP 8.2. In any case, you can disable debug mode to ignore deprecation errors.
 
You're running XF 2.2.13 on PHP 8.2+, which is not fully supported. XF 2.2.14+ has better support for PHP 8.1 and PHP 8.2. In any case, you can disable debug mode to ignore deprecation errors.

Should I update to 2.2.14-2.2.16?
I forgot to include what the main page looks like.

1719930438893.webp
 
Back
Top Bottom