at-import / breakpoint

Really simple media queries in Sass
MIT License
2.09k stars 142 forks source link

Allow `null` or `false` breakpoints to output styles without media query #165

Open amiuhle opened 8 years ago

amiuhle commented 8 years ago

I write the following simple helper mixin to just output the @content without any media query if it is passed false.

@mixin optional-breakpoint($breakpoint) {
  @if $breakpoint {
    @include breakpoint($breakpoint) {
      @content;
    }
  } @else {
    @content;
  }
}

What I'm doing is loop over a list of attributes, eg $h1: ((false, 20px, 24px, normal), ($tablet, 34px, 40px, -1px), ($desktop, 38px, 45px, -2px)). Using the helper mixin, I can just loop over the list and call the mixin, not caring about whether I actually want a media query or just the styles.

Am I missing something or is this really not possible without the helper mixin at the moment?