Question

@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?

Was it helpful?

Solution

That error could happen if you're accidentally mixing tabs and spaces in your CoffeeScript. You probably won't be able to see the problem with your eyes and the copy/paste you're doing to check your work at coffeescript.org could convert the tab to spaces behind your back.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top