less.js: Mixins should accept LESS blocks

It would be helpful if mixins had access to a content block passed to them, so one could encapsulate media queries or browser hacks in a central place and reference them symbolically.

This is basically the “Passing Content Blocks to a Mixin” feature of SASS: http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#mixin-content

In LESS this would mean something like:

.mobile() {
  @media all and (max-device-width: 480px) {
    @content
  }
}
.big-desktop-button {
  ...
  .mobile {
    display:none;
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 65 (21 by maintainers)

Most upvoted comments