0
@element.stop().animate
  scrollLeft: @left
  scrollTop:  @top
, @options.duration, "linear"

it compiles in online interpreter (coffeescript.org) to:

this.element.animate({
  scrollLeft: this.left,
  scrollTop: this.top
}, this.options.duration, "linear");

But middleman (it uses sprockets) throws an exception about "." in "@options.duration":

Uncaught Error: ExecJS::ProgramError: Error: Parse error on line 131:
Unexpected '.' (in */source/javascripts/views/scene.js.coffee) application.js:1
(anonymous function)

I am new to coffee script. Does it look like bug in sprockets?

4

1 回答 1

1

如果您不小心在 CoffeeScript 中混合了制表符和空格,则可能会发生该错误。您可能无法用眼睛看到问题,并且您在 coffeescript.org 上检查您的工作所做的复制/粘贴可能会将制表符转换为您背后的空格。

于 2012-05-03T18:02:22.400 回答