can't use Hashes from Stylus

こ雲淡風輕ζ 提交于 2019-12-10 22:54:06

问题


I read http://learnboost.github.io/stylus/docs/hashes.html and none of the examples not working for me. For exapmle

foo = {
  bar: {
    baz: {
      raz: 10px
    }
  }
}


qux = "raz"
padding
    padding foo["bar"].baz[qux]

a compilation error

expected "indent", got "eos"

What did I do wrong?


回答1:


You should use colon when calling hashes' values, as otherwise Stylus couldn't differentiate between selectors and hashes. So,

foo = {
  bar: {
    baz: {
      raz: 10px
    }
  }
}


qux = "raz"
padding
    padding: foo["bar"].baz[qux]

should work ok.



来源:https://stackoverflow.com/questions/28415015/cant-use-hashes-from-stylus

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!