SomMeri / less4j

Less language is an extension of css and less4j compiles it into regular css. Less adds several dynamic features into css: variables, expressions, nested rules, and so on. Less was designed to be compatible with css and any correct css file is also correct less file.
145 stars 47 forks source link

Problem with nested mixins #303

Closed casph closed 8 years ago

casph commented 8 years ago

Hi, i've this little problem, above code compile correctly in less, but in less4j throw an exception: I really cannot understand where is the problem...

.test-case {

  @unit: 5%;

  .test-fn(@n, @important) {

      @width: round(@unit * @n, 2);

      & when (@important = false) {
        width: @width;
      }
      & when (@important = true) {
        width: @width !important;
      }
  }
  .test-rule(@n, @important: true) {
    .rule-@{n} {
      .test-fn(@n, @important);
    }
  }

  .test-rule(1);
  .test-rule(2, false);
}
com.github.sommeri.less4j.Less4jException: Could not compile less. 7 error(s) occurred:
no viable alternative at input '(' in ruleset (which started at 539:1)
 550:   .test-fn(@n, @important) {
 551:   
no viable alternative at input '      ' in abstract mixin or namespace (which started at 550:3)
 552:       & when (@important = false) {
 553:         width: round(@unit * @n, 2);

Thanks in advance.

casph commented 8 years ago

Sorry, i tried last version and now it's working. I was using 1.11.