less / less.ruby

Less Ruby — now at http://github.com/cowboyd/less.rb
Apache License 2.0
956 stars 69 forks source link

looping #179

Open lukeholder opened 12 years ago

lukeholder commented 12 years ago

can you do this is less?

sass example:

$starWidth: 44px;
$starOffset: 0 -43px;
$numStars: 5;
$steps: 2;
$total: $numStars * $steps;

@mixin filled($n: 0) {
  width: ($starWidth / $steps) * $n;
}

.stars {
  background: url(/images/sprite.png) repeat-x top left;
  height: 43px;

  &.empty {
    background-position: $starOffset;
    width: $numStars * $starWidth;
  }

  @for $i from 0 through ($total) {
    &.filled_#{$i} { @include filled($i) }
  }
}