You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No. I thought you did. Definitely need to be done.
I looked at the parser code. It seems that it does not have a tokenier and everything is character based instead of token based. It should be rewritten completely but it seemed that your patch may work for the moment.
It's actually the intended behavior but I agree with you that is not what should happen. It would be better if a math expression has to be inside @(...) or something in order to avoid these kind of problems. Right now the way to go around this is using escaping ~"..."
In your example:
.push{margin: ~"5px -160px 1.5em 160px"}
I think it would be better to specify (because less common) when an arithmetic operation is expected instead of having to specify when it is not expected.
In the past when I had to implement one, I used interfaces similar to Tokenizer.getCurrentToken(), Tokenizer.followingToken(), Tokenizer.previousToken(), Tokenizer.next()
Activity
revolunet commentedon Sep 29, 2011
i think i fixed this issue here : revolunet@eaa6f26
not merged in main repo though
ChrisCinelli commentedon Oct 3, 2011
@revolunet. IT sound right. Issue a pull request and hopefully Cloudhead will add it.
revolunet commentedon Oct 3, 2011
did you test this modif ?
ChrisCinelli commentedon Oct 3, 2011
No. I thought you did. Definitely need to be done.
I looked at the parser code. It seems that it does not have a tokenier and everything is character based instead of token based. It should be rewritten completely but it seemed that your patch may work for the moment.
fix less#31 and less#406
revolunet commentedon Oct 3, 2011
please confirm this last commit works for you
default007 commentedon Oct 4, 2011
Please notice that a similar bug also happens with line breaks inside the rule description. The following valid output of a minifier:
.push{margin:5px
-160px 1.5em 160px}
is converted into
.push {
margin: -155px 1.5em 160px;
}
The maths are computed between the first two items, and I get a subtraction!
ChrisCinelli commentedon Oct 4, 2011
@default007: This is a different thing.
File a new bug.
It's actually the intended behavior but I agree with you that is not what should happen. It would be better if a math expression has to be inside @(...) or something in order to avoid these kind of problems. Right now the way to go around this is using escaping ~"..."
In your example:
.push{margin: ~"5px -160px 1.5em 160px"}
I think it would be better to specify (because less common) when an arithmetic operation is expected instead of having to specify when it is not expected.
default007 commentedon Oct 5, 2011
Is it? It only happens after a line break. The following, for example, works OK:
.push{margin: 5px -160px 1.5em 160px}
That I don't need to escape.
It also works if I apply a hack to my minifier, to put a space after the line break, like this:
.push{margin:5px -160px 1.5em 160px}ChrisCinelli commentedon Oct 10, 2011
CSS is a free-form language (http://en.wikipedia.org/wiki/Free-form_language) in which the positioning of characters on the page in program text is not significant. Which characters are used \n \t etc and their number should do not matter.
This is not currently true for less.js and it makes not fully compatible with CSS syntax. In my humble opinion this should be changed.
As I wrote in a comment above, less.js' parser does not have a tokenizer. There are a lot of comparisons with a normal space (' ') in the code that create peculiar behaviors like the one you described. Something like this should be used: http://www.cdiggins.com/tokenizer.html
In the past when I had to implement one, I used interfaces similar to Tokenizer.getCurrentToken(), Tokenizer.followingToken(), Tokenizer.previousToken(), Tokenizer.next()
fix #31 and #406
lukeapage commentedon Aug 19, 2012
@ChrisCinelli it doesn't have a "proper" tokenizer.. anyway, have pulled fix from @revolunet.
There is one more place looking at space and that causes the bug mentioned above.. will look at it next.
Fix other whitespace issue brought up in #406