L
L
lavezzi12015-10-01 15:43:49
css
lavezzi1, 2015-10-01 15:43:49

Mixin for media query on stylus?

Hello.
Advise how convenient it is to write media query on stylus. Something like this for scss:

// breakpoints
   
$S:     480px; 
$M:     768px;
$ML:    960px;     
$L:     1170px;     
$XL:     1440px;   

// media queries

@mixin MQ($canvas) {
  @if $canvas == S {
   @media only screen and (min-width: $S) { @content; } 
  }
  @else if $canvas == M {
   @media only screen and (min-width: $M) { @content; } 
  }
  @else if $canvas == ML {
   @media only screen and (min-width: $ML) { @content; } 
  }
  @else if $canvas == L {
   @media only screen and (min-width: $L) { @content; } 
  }
  @else if $canvas == XL {
   @media only screen and (min-width: $XL) { @content; } 
  }
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey B., 2015-10-01
@lavezzi1

Query mixin grid stylus
first link davidwalsh.name/stylus-grid

I
Ivanq, 2015-10-01
@Ivanq

I am amazed at people who first go to the forum, and then, not finding an answer, climb into Google.
Media query stylus , first link is https://learnboost.github.io/stylus/docs/media.html

K
Konstantin Velichko, 2016-12-14
@Zoxon

https://github.com/jescalan/rupture

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question