2

我正在尝试使用 stylus 和 twitter bootstrap 2.04 版的 css 预处理器。当我下载 boostrap 时,我运行“stylus --css < bootstrap.css > bootstrap.styl”,这样我就可以创建一个 bootstrap.styl 文件。但是,当我的浏览器尝试解析 bootstrap.styl 时出现以下错误

ParseError: /Users/user/Projects/node_tutorials/project/static/css/bootstrap.styl:1835
   1831|   background-position: -313px -119px
   1832| 
   1833| .icon-retweet
   1834|   background-position: -336px -120px
 > 1835| 
   1836| .icon-shopping-cart
   1837|   background-position: -360px -120px
   1838| 

expected "indent", got "outdent"

at Parser.error (/Users/user/Projects/node_tutorials/project/node_modules/stylus/lib/parser.js:166:11)
at Parser.expect (/Users/user/Projects/node_tutorials/project/node_modules/stylus/lib/parser.js:194:12)
at Parser.block (/Users/user/Projects/node_tutorials/project/node_modules/stylus/lib/parser.js:597:12)
at Parser.selector (/Users/user/Projects/node_tutorials/project/node_modules/stylus/lib/parser.js:1099:24)
at Parser.property (/Users/user/Projects/node_tutorials/project/node_modules/stylus/lib/parser.js:1013:47)
at Parser.ident (/Users//Projects/node_tutorials/project/node_modules/stylus/lib/parser.js:970:25)
at Parser.stmt (/Users/user/Projects/node_tutorials/project/node_modules/stylus/lib/parser.js:546:25)
at Parser.statement (/Users/user/Projects/node_tutorials/project/node_modules/stylus/lib/parser.js:458:21)
at Parser.block (/Users/user/Projects/node_tutorials/project/node_modules/stylus/lib/parser.js:609:21)
at Parser.selector (/Users/user/Projects/node_tutorials/project/node_modules/stylus/lib/parser.js:1099:24)

我检查了额外的空格,甚至已经对文件进行了十六进制转储,似乎没有任何问题。任何人都可以识别问题吗?

4

2 回答 2

3

@Jonathan 是对的。问题是由过滤器引起的

我找到了使用手写笔功能的解决方法unquote

只需对 bootstrap.styl进行正则表达式替换filter: (.+)$=>filter: unquote("\1")

于 2012-12-30T05:37:22.493 回答
1

你检查了整个文件的缩进吗?这种消息通常是由在解析器发现错误之前定位的错误引起的。

于 2012-06-25T05:57:10.440 回答