2014-04-01 26 views
2

它的怪異,我只是做在變量設置的更改使用哈希,而不是...你知道:筆扔了我的預期「縮進」,得到了「減少縮進」,但我不知道爲什麼

black = #000 

被替換爲:

colors = { 
    'black': #000 
    // and so on... 
} 

然後,我更換所有可變調用的代碼(ofcourse)和所有模塊編譯良好,除了一個,這是跟蹤:

ParseError: ../../dopamine/components/_ui.styl:26 
    22|  notice(clr: -colors['light-blue']) 
    23|  color -colors['white'] 
    24|  font-weight bold 
    25|  text-shadow 1px 1px 1px rgba(#000, .2) 
> 26| 
    27| if type == "success" 
    28|  notice(clr: -colors['green']) 
    29|  color -colors['white'] 

expected "indent", got "outdent" 

    at Parser.error (/usr/local/lib/node_modules/stylus/lib/parser.js:230:11) 
    at Parser.expect (/usr/local/lib/node_modules/stylus/lib/parser.js:258:12) 
    at Parser.block (/usr/local/lib/node_modules/stylus/lib/parser.js:741:12) 
    at Parser.selector (/usr/local/lib/node_modules/stylus/lib/parser.js:1277:24) 
    at Parser.property (/usr/local/lib/node_modules/stylus/lib/parser.js:1228:47) 
    at Parser.ident (/usr/local/lib/node_modules/stylus/lib/parser.js:1183:25) 
    at Parser.stmt (/usr/local/lib/node_modules/stylus/lib/parser.js:685:26) 
    at Parser.statement (/usr/local/lib/node_modules/stylus/lib/parser.js:593:21) 
    at Parser.block (/usr/local/lib/node_modules/stylus/lib/parser.js:753:21) 
    at Parser [as if] (/usr/local/lib/node_modules/stylus/lib/parser.js:842:23) 

所以,我檢查了基本的常見打字錯誤和其他事情,但我沒有得到這個問題......在最後一個版本中沒有工作,我只是改變了變量,我沒有再碰任何東西。該代碼是在以下幾個環節:

error module variable settings

因此,對於任何回答謝謝!

回答

5

不幸的是,當使用散列作爲值時,您還需要使用冒號。所以,與其

.best-thing-ever 
    width 1234px 
    color colors['white'] 
    font-size 23px 

你會寫

.best-thing-ever 
    width 1234px 
    color: colors['white'] 
    font-size 23px 

注意冒號只需要對具有作爲哈希值的屬性。詳情請參閱this related issue on GitHub

相關問題