2013-07-11 8 views
5

私はSassからStylusへ移りました。mixin内でコードブロックに渡したくなるたくさんのミックスインがあります。@contentです。例えばコードブロックをスタイラスの関数またはミックスインに渡す方法

...

@mixin respond-min($width) { 
    // If we're outputting for a fixed media query set... 
    @if $fix-mqs { 
     // ...and if we should apply these rules... 
     @if $fix-mqs >= $width { 
      // ...output the content the user gave us. 
      @content; 
     } 
    } 
    @else { 
     // Otherwise, output it using a regular media query 
     @media all and (min-width: $width) { 
      @content; 
     } 
    } 
} 

@include respond-min($mq-group2) { 
    & { 
     border: 1px solid green; 
    } 
} 

私がこれまでにあったとして、スタイラスがに表示されないよう、私はミックスインにコードブロックを渡す方法をスタイラスに上記のコードを変換したいのですが、私の主な問題その特徴があります。

代替ソリューションはありますか?

助けてください。

+0

あなたは現在、ミックスインを作成し、それを引数として渡す必要があり優れた – Ven

答えて

6

- 0.41.0、上記のようにスタイラスで書くことができコード:

respond-min($width) 
    // If we're outputting for a fixed media query set... 
    if $fix-mqs is defined 
    // ...and if we should apply these rules... 
    if $fix-mqs >= $width 
     // ...output the content the user gave us. 
     {block} 
    else 
    // Otherwise, output it using a regular media query 
    media = 'all and (min-width: %s)' % $width 
    @media media 
     {block} 

+respond-min($mq-group2) 
    border: 1px solid green 
+2

!どうもありがとうございました。私は近い将来、BBC NewsをSassからStylusに移行しようと考えています:-) – Integralist

0

@mediaクエリに複数の引数を渡すことに関する現在未解決の問題があることは注目に値する。 mixinsはセレクタとしても使用できません。これは、スタイラスの最新リリースで可能になっ

関連する問題