Is dotless the same exact syntax as the less css l

2019-06-18 14:31发布

问题:

The .less library calls itself a port of ruby LESS library. Can I take away from that that they both are compilers for the same LESS file format or do they expect subtly different less code? Asked another way, am I locking myself in to the dotless library or can use dotless and the less javascript lib on the less files?

回答1:

Dotlesscss is a straight (almost 1:1 port) of the JavaScript project less.js (a JavaScript implementation of LessCSS by Cloudhead the original author of LessCss for Ruby)

In 99% of the cases the same code that runs on dotlesscss will run on less.js and vice versa. If something works on less.js and doesn't on dotlesscss we consider that a bug and try to fix it if possible.

There are very subtle differences though as it is very hard to keep three different projects 100% synced up.

For one that would be different function names. Examples would be the color manipulation functions that we implemented before the LessCss project, as we named these after their SASS equivalents..

But in general: the language though is 100% compatible.

You are not limiting yourself to one language. You should be able to move between different implementations fairly easily.

Also dotless runs on Mono so you are not locked to a specific OS either.

If you encounter any problems feel free to raise an Issue on our GitHub Page or through the Mailing List



回答2:

They're supposed to be equivalent implemnentations however there is a hudge difference between

  • the server side implementations (ruby, .net, php ...)
  • the client side javascript implementation

The big difference is that with the client side implementation, you'll be able to use all the dom of the browser in your less files and this would never work with server side implementations :

@height: `document.body.clientHeight`;

More over, in the current version of dotless (1.2.4.0), javascript evaluation is not implemented and is rendered as [script unsupported] in the css output.



标签: less dotless