【问题标题】:can't use Hashes from Stylus无法使用 Stylus 中的哈希
【发布时间】:2015-02-09 16:53:55
【问题描述】:

我阅读了http://learnboost.github.io/stylus/docs/hashes.html 并且没有一个示例对我不起作用。 例如

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


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

编译错误

expected "indent", got "eos"

我做错了什么?

【问题讨论】:

    标签: stylus


    【解决方案1】:

    在调用哈希值时应该使用冒号,否则 Stylus 无法区分选择器和哈希值。所以,

    foo = {
      bar: {
        baz: {
          raz: 10px
        }
      }
    }
    
    
    qux = "raz"
    padding
        padding: foo["bar"].baz[qux]
    

    应该没问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-27
      • 1970-01-01
      • 2018-05-20
      • 1970-01-01
      • 1970-01-01
      • 2015-10-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多