How can I get rails / coffee rails to use the latest coffee compiler script

My coffee scripts contain chained object calls that compile correctly when using the last compiler (manually), but cannot compile correctly when using the rails / coffee-script tools in the asset pipeline.

What is the best way to get around this? It is preferable to use the latest coffee compiler.

Here is an example of my coffee script, with chain calls

// coffeescript
someObject
  .chainedMethod 'home', {
      paramA: 'a'
      paramB: 'b'
    }
  .chainedMethod 'signin', {
      paramA: 'xx'
      paramB: 'yy'
      controller: 'SignInController'
    }

When compiled correctly, it looks like this:

// javascript
someObject.chainedMethod('home', {
  paramA: 'a',
  paramB: 'b'
}).chainedMethod('signin', {
  paramA: 'xx',
  paramB: 'yy',
  controller: 'SignInController'
});

The Rails 4.0 Resource Pipeline creates the following:

// buggy javascript
someObject.chainedMethod('home', {
  paramA: 'a',
  paramB: 'b'
}.chainedMethod('signin', {
  paramA: 'xx',
  paramB: 'yy',
  controller: 'SignInController'
}));
+3
source share
1 answer

, - script. , / - , . script - . - script http://coffeescript.org/

bundle update coffee-script-source .

gem .

coffee-script-source-1.7.0
coffee-script-2.2.0
coffee-rails-4.0.1
0

All Articles