2016-05-21 1 views
0

私は、次のスタイラスコードダイナミックプロパティは、スタイラスで機能を構築し、期待を与える「:」、だ「[」

spaces = { 
    none: 0, 
    xxx-small: .125, 
    xx-small: 25, 
    x-small: .5, 
    small: .75 
    medium: 1, 
    large: 1.5, 
    x-large: 2, 
    xx-large: 3 
} 
properties = top, right, bottom, left 
types = { 
    m: margin, 
    p: padding 
} 
space() 
    for type in types 
    for property in properties 
     for space in spaces 
     .{type}-{property}--{space} 
      {types[type]}-{property}: {spaces[space]}rem 

space() 

を持っている私はの線に沿って出力何かにそれをしたいと思います:

.m-top--none { 
    margin-top: 0rem; 
} 
.m-top--xxx-small { 
    margin-top: 0.125rem; 
} 

etc 

しかし、私はエラーに直面しているのです:

expected ":", got "["

任意のアイデア私がここで間違って何をやりましたか?もし私が{spaces[space]}remを取って、例として1000%に置き換えても、それはうまくいくと思われますか?

答えて

1

現在、スタイラスはプロパティ値内の補間をサポートしていません。この場合、()を使用する必要があります。

{types[type]}-{property}: (spaces[space])rem 
+0

ああ、そうでした。どうもありがとうございました! –

関連する問題