Search code examples
media-queriesstylus

Stylus replace long @media line with a keyword


Is it possible in Stylus to define a keyword/variable to be used instead of a long @media line-rule?

For instance:

IE = @media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm)

And then use it as

.div1
    IE
        color red

Solution

  • Yep, something like this:

    IE = 'all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm)'
    
    .div1
      @media IE
        color red