Stylusの書き方まとめ 内挿、補間編

[feature cat=”howto-stylus”]

{}で補間


vendor(prop, args)
  -webkit-{prop} args
  -moz-{prop} args
  {prop} args

border-radius()
  vendor('border-radius', arguments)

box-shadow()
  vendor('box-shadow', arguments)

button
  border-radius 1px 2px/3px 4px
  box-shadow rgba(0,0,0,0.5)

//

button {
  -webkit-border-radius: 1px 2px/3px 4px;
  -moz-border-radius: 1px 2px/3px 4px;
  border-radius: 1px 2px/3px 4px;
  -webkit-box-shadow: rgba(0,0,0,0.5);
  -moz-box-shadow: rgba(0,0,0,0.5);
  box-shadow: rgba(0,0,0,0.5);
}

セレクタの補間

{}で


for row in 1..3
  tr:nth-child({row})
    height: 10px * row

//

tr:nth-child(1) {
  height: 10px;
}
tr:nth-child(2) {
  height: 20px;
}
tr:nth-child(3) {
  height: 30px;
}