手写笔给我一个预期的"缩进",得到"突出",但我不知道为什么

Nan*_*ano 2 stylus indentation parse-error

这很奇怪我只是在变量设置中进行更改以使用哈希代替...你知道:

black = #000
Run Code Online (Sandbox Code Playgroud)

被替换为:

colors = {
    'black': #000
     // and so on...
}
Run Code Online (Sandbox Code Playgroud)

然后,我替换代码(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)
Run Code Online (Sandbox Code Playgroud)

所以,我检查了基本的常见输入错误和其他的事情,但我没有得到问题...在最后一个版本确实工作,我只是改变了变量,我没有触及任何更多.代码在以下链接中:

错误模块 变量设置

所以,谢谢你的回答!

don*_*nut 5

不幸的是,当使用哈希作为值时,您还需要使用冒号.所以,而不是

.best-thing-ever
  width 1234px
  color colors['white']
  font-size 23px
Run Code Online (Sandbox Code Playgroud)

你会写的

.best-thing-ever
  width 1234px
  color: colors['white']
  font-size 23px
Run Code Online (Sandbox Code Playgroud)

请注意,只有具有哈希值的属性才需要冒号.有关详细信息,请参阅GitHub上的相关问题.