• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 ParseError: Unexpected input ...

BassMan

Well-known member
#1
After uninstalling add-on I get this error:


Server error log

  • Less_Exception_Chunk: ParseError: Unexpected input in anonymous-file-0.less on line 1586, column 22 1584| } 1585| 1586| .cxf-af-social-icons . { 1587| color: ; 1588| } 1589|
  • src/vendor/oyejorge/less.php/lib/Less/Parser.php:677
  • Generated by: Unknown account
  • 23. nov 2017 ob 20:52
Stack trace
#0 src/vendor/oyejorge/less.php/lib/Less/Parser.php(621): Less_Parser->GetRules(NULL)
#1 src/vendor/oyejorge/less.php/lib/Less/Parser.php(449): Less_Parser->_parse()
#2 src/XF/CssRenderer.php(330): Less_Parser->parse('// Note that th...')
#3 src/XF/CssRenderer.php(311): XF\CssRenderer->renderToCss('public:extra.le...', '// Note that th...')
#4 src/XF/CssRenderer.php(235): XF\CssRenderer->renderTemplate('public:extra.le...', NULL)
#5 src/XF/CssRenderer.php(101): XF\CssRenderer->renderTemplates(Array, Array, Array)
#6 src/XF/CssWriter.php(53): XF\CssRenderer->render(Array)
#7 css.php(30): XF\CssWriter->run(Array, 0, 3, 'b9290ae42bdcdd5...')
#8 {main}

-------------------

It's my add-on with template modifications. It wasn't respecting css changes and template modifications after upgrading to RC3. That's why I've decided to uninstall it, but get that error. Not sure what is wrong exactly.
 

Chris D

XenForo developer
Staff member
#2
Well, it seems to be struggling parsing extra.less. Are you using extra.less in your add-on? What is the content of your extra.less template either before or after the add-on uninstall?
 

BassMan

Well-known member
#3
Yes, I am. Actually, maybe I'm doing it wrong. I use TM for extra.less where in the Replace field I put to inculde .less template that I made. As I was aware it was all working fine till upgrade to RC3.

The content of my extra.less template was the same, a few lines of code.
 

BassMan

Well-known member
#5
CSS:
{{ include('extra_banners.less') }}
{{ include('extra_categories.less') }}
{{ include('extra_notices.less') }}
{{ include('extra_prefixes.less') }}

/*** LOGO **/
.p-header-logo.p-header-logo--image img {
    height: 90px;
    padding-left: 26px;
}
/*****/

/*** RSS button ***/
.rssButton {
    background: #326B9E;
    padding: 1px 5px;
    border-radius: 3px;
}

.rssButton:hover {
    background: #4A4E51;
}

.rssButton a {
    color: #fafafa;
}
.rssButton a:hover {
    text-decoration: none;
}
/*****/
 

Chris D

XenForo developer
Staff member
#6
This hints specifically to the content that was in it when it attempted to parse it:
Code:
#3 src/XF/CssRenderer.php(311): XF\CssRenderer->renderToCss('public:extra.le...', '// Note that th...')
// Note that th... is that in one of those included templates?

We haven't changed anything in the Less parser so really you have to try and identify specifically what the problematic code is. You might need to strip out each of the includes until you find one that lets it parse.
 

BassMan

Well-known member
#8
Well, i quick look in search templates for "Note that th" it gave me those templates:

1511468632967.png

I never change or use those two files.
 

Chris D

XenForo developer
Staff member
#9
That actually makes sense. We prepend all templates with setup.less, so we can disregard that.

But if the template is failing to parse then it will be something within extra.less.
 

Chris D

XenForo developer
Staff member
#10
As a side note I would discourage from making use of extra.less in this way. It really is just designed for style specific user customisations.
 

BassMan

Well-known member
#12
Chris, can I use this in .less template?

CSS:
<xf:if is="$xf.options.test == 'enabled'">
some css code
</xf:if>
If I remove that xf:if code the css works, with that code which points to options css doesn't always apply.

Should I use it only with style property like <xf:if is="property('test') == 'enabled'">?
 

BassMan

Well-known member
#13
Found issue. Well, at least in my case.

If you use for example <xf:if is="$xf.options.test == 'enabled'"> in .less file things will not work like they should. When I used <xf:if is="property('test') == 'enabled'"> with same code in .less file it works normal.

Just need to press CTRL+F5 after enabling/disabling option if usingChrome, in Firefox change takes effect normally. Actually not sure about that. Now it was working also in Chrome. Guess some caching from before...

EDIT: actually, this is how it works for me now: if I use <xf:if is="$xf.options.test == 'enabled'"> for class that I've made it works, but if I use it for existing class for example p-footer it will not work, but it works with <xf:if is="property('test') == 'enabled'">. I don't know why, but I've tested several times on two forums so I can confirm it.
 
Last edited: