leafo / lessphp

LESS compiler written in PHP
http://leafo.net/lessphp
Other
2.2k stars 529 forks source link

Undefined function #613

Open b4oshany opened 9 years ago

b4oshany commented 9 years ago

I got undefined function, .generate-font-size(@n, @i: 1), whenever I compile the code below:

/**
Generate font size of 18n, where n is an integer and 0 < n < 11.
*/

.generate-font-size(@n, @i: 1) when (@i =< @n) {
  .font-size-@{i}x {
    @media (max-width: 768px){
      font-size: (@i * 8pt) !important;
    }
    @media (min-width: 768px){
      font-size: (@i * 12pt) !important;
    }
  }
  .font-sm-@{i}x {
    @media (max-width: 959px){
      font-size: (@i * 8pt) !important;
    }
  }
  .font-xs-@{i}x {
    @media (max-width: 418px){
      font-size: (@i * 6pt) !important;
    }
  }
  .generate-font-size(@n, (@i + 1));
}

.generate-font-size(10);

This error only happens in version 0.5. It is working perfectly, in version 0.4. I had to downgrade to 0.4. Could you fix this problem?

pafnuty commented 9 years ago

@b4oshany try this class https://github.com/oyejorge/less.php