O
O
Oleg Maksimov2017-02-20 13:09:19
css
Oleg Maksimov, 2017-02-20 13:09:19

Is there an analogue of the @content directive from Sass in Stylus?

Is there an analogue of the @content directive from Sass in Stylus?
For example, rewrite the
mixin @mixin keyframes ($animation-name) {
@-webkit-keyframes $animation-name{
@content;
}
@-moz-keyframes $animation-name{
@content;
}
@-ms-keyframes $animation-name{
@content;
}
@-o-keyframes $animation-name{
@content;
}
@keyframes $animation-name{
@content;
}
}
use
p {
@include keyframes("my-anim") {
0% { font-size: 20px; }
100% { font-size: 30px; }
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2017-02-20
@nucknine

In Stylus prefixes for keyframes will be added automatically enough entry:

@keyframes myanim
  0%
    font-size 20px
  100%
    font-size 30px

But automatic prefixes will be removed in version 1.0, although it is not clear when it will still be.
As for blocks, of course it is possible:
// Mixin
key( name = 'name' )
    @keyframes {name}
      {block}

// Use
p
   +key( 'font' )
    0%
      font-size 20px
    100%
      font-size 30px

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question