Skip to content

Less js differences

Kobi edited this page Jul 25, 2013 · 8 revisions

Differences between less.js and dotless

There are many ways in which dotless offers something more than less.js (see Plugins and Parameters) but this page focuses on differences.

Comment support

dotless supports comments in more places than less.js, which will throw a parser error in certain situations. However if you keep comments in sensible places – after rules and before the selectors you are unlikely to notice anything.

Bugs

The following unfixed less.js bugs are fixed in dotless

Named Arguments

This has now been checked into less.js and will be included in the release after 1.3.0. When that is released this section should be removed.

In dotless it is possible to specify named arguments, e.g.

.mixin(@backColor, @foreColor) {
  background: @backColor;
  color: @foreColor;
}

.mixin(@foreColor:blue, @backColor:red);

Support for parent (&) operator

In 1.3.0.3 better support for for & operator was brought to dotless (see dotless bug). This fixed the following outstanding less.js bugs..

Scoping

We currently believe there are some scope bugs in less.js because we do not believe the features are by design. In dotless a variable has its own scope and referencing the same variable in different locations shouldn’t cause the variable to be re-evaluated in the context of the caller (that is what functions and mixins are for). This is sumarised in a bug against us.

JavaScript Support

In less.js you can use the backquote in order to execute JavaScript. This is not supported in dotless.

Color compression

In dotless we favour the color keyword over the hex code, if one matches. When compressing it chooses whichever is shorter.. e.g. #FFF, #FFFFFF, white then #FFF will be chosen, but in the case of red, the keyword red will be used.

In less.js every colour is replaced with a hex code.

If this produced a problem for someone we would change it.