Semicolon separated parameters for Mixins

216 views
Skip to first unread message

harm....@gmail.com

unread,
Mar 22, 2013, 4:52:25 PM3/22/13
to dot...@googlegroups.com
I'm trying to define a mixin that uses semicolons to separate parameters; however, I'm having no luck.  Below is the contents of test.less file:

@myBorder: "solid 1px black";


.myContainer(@border; @color) {
    border: @border;
}

.myDiv {
    .myContainer(@myBorder; "red");
}

When I use the command line to try to compile the file, I get:

C:\MSBuildFiles>dotless.Compiler.exe test.less
[Compile]
C:\MSBuildFiles\test.less -> C:\MSBuildFiles\test.css

Expected ')' but found ' ' on line 4 in file 'C:\MSBuildFiles\test.less':
  [3]:
  [4]: .myContainer(@border; @color) {
       --------------------^
  [5]:     border: @border;
[Done - Failed]

On the documentation at http://lesscss.org/, it mentions the ability to define mixins that have parameters separated by semicolons.  

Mixins With Multiple Parameters

Parameters are either semicolon or comma separated. It is recommended to use semicolon. The symbol comma has double meaning: it can be interpreted either as a mixin parameters separator or css list separator.

Using comma as mixin separator makes it impossible to create comma separated lists as an argument. On the other hand, if the compiler sees at least one semicolon inside mixin call or declaration, it assumes that arguments are separated by semicolons and all commas belong to css lists:

    • two arguments and each contains comma separated list: .name(123; something, else),
    • three arguments and each contains one number: .name(123),
    • use dummy semicolon to create mixin call with one argument containing comma separated css list:.name(123;),
    • comma separated default value: .name(@param1: red, blue;).
Is this supported in 1.3.1.0?

Luke Page

unread,
Mar 22, 2013, 4:54:05 PM3/22/13
to dot...@googlegroups.com

No, it was introduced in less.js 1.3.2

--
You received this message because you are subscribed to the Google Groups "DotLess (Less Css for .NET)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotless+u...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
Visit this group at http://groups.google.com/group/dotless?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages