Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Make less.js version compatibility more explicit #340

Open
mfdj opened this issue Feb 23, 2017 · 4 comments
Open

Make less.js version compatibility more explicit #340

mfdj opened this issue Feb 23, 2017 · 4 comments

Comments

@mfdj
Copy link

mfdj commented Feb 23, 2017

Suggestion

I'm opening this issue to help newcomers understand how less.php versioning works. I don't expect high-parity with less.js and I appreciate that maintaining an open source library (especially a cross-language port) is a tough job. Thanks for your hard work!

Currently it's not super obvious that less.php is compatible with less.js 1.7.0. Also, since less.js v3 is in the works I think it's important to clearly document which language features are supported so that users of this library (especially newcomers to the LESS language) have a clear idea of which features they can reliably use.

  • less.js tagged 1.7.0 3 years ago
  • 2.0 tagged stable 2.2 years ago
  • 1.7.5 is the latest stable 1.x version, was tagged 1.5 years ago
  • 3.0 is in the works lesscss.org/3.x/

Rationale: Unexpected LESS v1 behavior

I was recently caught off guard when I tried to use the word red in a list. The basic problem can be summarized by the following LESS snippet:

@color-words: white, purple, green, fuchsia, pink, orange, yellow;

.color-words {
    content: "@{color-words}";
}

In LESS 1.x it parses to:

.color-words {
  content: "#ffffff, #800080, #008000, #ff00ff, #ffc0cb, #ffa500, #ffff00";
}

In LESS 2.x it parses to:

.color-words {
  content: "white, purple, green, fuchsia, pink, orange, yellow";
}

I was trying to use white and red in a list of classes to generate codepen.io/mfdj/pen/PWMLVW. Since I'm new to using LESS it took me awhile to figure out this was a breaking change between LESS v1 and v2 and that less.php supported v1 syntax.

Related

The following issues helped me understand the state of things so I'm linking them here as others may find them interesting:

Also there are some forks in the wild, so I think it would be timely to make the scope of this project more clear:

@Asenar
Copy link
Collaborator

Asenar commented Feb 23, 2017

Hi,
thanks a lot for your resume !

Can you test if the official Lessc 2.0 converts WHITE to white (for example) ?

This methods to convert color names to hexa may be useful, so I will probably add an option to either keep color name or convert to hexa.

EDIT: it seems some values are ignored, like inherit. The only non-color word taken seems to be transparent

@mfdj
Copy link
Author

mfdj commented Feb 23, 2017

@Asenar Yes, LESS version 1 and 2 treat color words differently.

The issue I was facing is that I want to use red purely as a word, not as a color value. For example, I was trying to turn a color list into some swatch classes. To be honest, this is a tiny programming irritation to overcome.

@mfdj
Copy link
Author

mfdj commented Feb 23, 2017

The color-words issue is very minor to me, it is an irritating blemish on otherwise nice language. I'm pretty comfortable using LESS v1.7.0.

But it made me wonder: are there any LESS language features added in v2? I don't know. I'm pretty new to LESS, so I'm still trying to learn. From what I can tell looking at the less.js changelog is that a lot of the version changes are around the parser, not the language. But I haven't looked very closely, and frankly this is why I opened this issue: it takes a lot of time and energy to investigate this stuff.

Mainly I'm trying to surface knowledge and pushing for better docs. Not asking for any radical interventions.

I think this is double important if LESS v3 introduces breaking changes, or adds new behavior. At present it's not clear from oyejorge/less.php README.md that this library is pinned at LESS v1.7 even though LESS v2 has been out for years.

I'm familiar with SASS and the nice thing about SASS is they do a good job of documenting the language features and the community keeps track of all of the different SASS parsers: sass-compatibility.github.io

@mishal
Copy link

mishal commented Feb 24, 2017

@mfdj: if you need less 2 features use can use iless... https://packagist.org/packages/mishal/iless

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants