2011-12-31 3 views
4

Twitter Bootstrapの2.0-wipブランチを参照すると、LESSには変数とミックスインがバンドルされていることがわかりました。以下のサンプルコードを参照してください。LESSのネームスペースのSCSSとは何か、クラスのバンドル

#font { 
    #family { 
    .serif() { 
     font-family: Georgia, "Times New Roman", Times, serif; 
    } 
    .sans-serif() { 
     font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 
    } 
    .monospace() { 
     font-family: Menlo, Monaco, Courier New, monospace; 
    } 
    } 
    .shorthand(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) { 
    font-size: @size; 
    font-weight: @weight; 
    line-height: @lineHeight; 
    } 
    .serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) { 
    #font > #family > .serif; 
    #font > .shorthand(@size, @weight, @lineHeight); 
    } 
    .sans-serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) { 
    #font > #family > .sans-serif; 
    #font > .shorthand(@size, @weight, @lineHeight); 
    } 
    .monospace(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) { 
    #font > #family > .monospace; 
    #font > .shorthand(@size, @weight, @lineHeight); 
    } 
} 

これと同等のSCSSは何ですか? SCSSで上記をどのように書き直すのですか?

+0

その2016 – harshitgupta

+0

ああ!これは何年も前のスレッドです。 Btw、Sassのネームスペースの考え方 - https://changelog.com/namespace-support-is-being-added-to-sass/ – Brajeshwar

答えて

1

残念ながら、これはSCSSの欠けている機能です(私によると)。この質問に対する答えはです。と同等のSCSSはありません。 SCSS互換の方法で書き直す必要があります。 SCSS Twitter Bootstrap forkの私の書き換えを見てください(あなたが言及した例を使用します)。

P.S.そのフォークを使用しないでください。これは現在管理されておらず、公式のTwitter Bootstrapのwikiに記載されているものを使用する方が良いでしょう。 (details

+0

ここのリンクは両方とも404です – gabe

関連する問題