title: Advice on migrating a web app source code from Coffeescript to javascript
body: <p>I've inherited responsibility for a moderately complex Rails app, which has meant learning Ruby and Rails besides trying to understand a lot of code that I did not write myself. The project also contains a non-trivial Backbone.js app written in Coffeescript. Since I will be the sole developer on this project for a long time, and since I don't know Coffeescript, I plan to move the entire source code to straight Javascript. </p>
  
  <p>I would like to know what the best approach to doing this would be. Compiling to javascript is easy enough, but there is a lot of refactoring to do to make the code look "normal".</p>
  
  <p>Cleaning up cruft by replacing stuff like </p>
  
  <pre><code>var a;
  a = 1;
  </code></pre>
  
  <p>with</p>
  
  <pre><code>var a = 1;
  </code></pre>
  
  <p>is simple enough, or perhaps not even worth bothering with. I am more worried about the overall structure of the project. Coffeescript produces files that begin like this Backbone view code:</p>
  
  <pre><code>(function() {
    var extend = function(child, parent) {
      for (var key in parent)           {
          if (hasProp.call(parent, key)) child[key] = parent[key];
    } function ctor() {
          this.constructor = child;
        }
      ctor.prototype = parent.prototype;
      child.prototype = new ctor();
      child.__super__ = parent.prototype; return child;
    },
             hasProp = {}.hasOwnProperty;
  
  App.Views.MyClass = (function(superClass) {
  extend(MyClass, superClass);
  
  function MyClass() {
    return MyClass.__super__.constructor.apply(this, arguments);
  }
  # rest of the code here...
  
      });
  }).call(this);
  </code></pre>
  
  <p>I would just like to know what a sane approach to dealing with this would be, and I haven't found any kind of "best practices" for doing what I would like to do. </p>
  
  <p>What would be best:  just check everything into git and keep going? Use the Backbone/Underscore version of <code>extend</code> instead of redefining the same function at the top of every file? Use a different method entirely for stringing together all of the separate files?</p>
  
  <p>Just looking for a general direction. I'll figure out the details.</p>