Search code examples
cssstylus

Mixin in Stylus


There are two elements with two common properties but their values are various below,

EL_a
  p1 v1_a
  p2 v2_a

EL_b
  p1 v1_b
  p2 v2_b

Can we make a proper mixin in stylus to pass the respective values below?

EL_a
  mixin v1_a v2_a

EL_b
  mixin v1_b v2_b

Solution

  • Not sure what you want, maybe this can help you:

    <div class="DivD">
       MIX
    </div>
    
    mixing0(wid = 20px, col = #e33)
        width: wid
        color: col
    .DivD
        mixing0 200px green
    

    http://stylus-lang.com/docs/mixins.html