2016-05-21 6 views
0

Ich habe folgende Stylus Codedynamische Eigenschaft Build-Funktion in Stylus gibt eine erwartete ":", bekam "["

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() 

ich es ausgeben etwas entlang der Linien von möchte:

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

etc 

jedoch habe ich mit dem Fehler bin konfrontiert:

expected ":", got "["

Irgendwelche Ideen

, was ich hier falsch gemacht? Wenn ich die {spaces[space]}rem nehme und nur mit 1000% als ein Beispiel ersetze, scheint es zu funktionieren?

Antwort

1

Stylus unterstützt derzeit keine Interpolation innerhalb von Eigenschaftswerten. Sie müssen () in diesem Fall verwenden:

+0

Ah ja, das hat es getan. Vielen Dank! –

Verwandte Themen