0

My CoffeeScript code is ~6,000 lines. For my sanity, I want to separate it to several files.

CoffeScript adds a wrapper for every file:

(function() {

  something = [1,2,3]

}).call(this);

But instead, I want it to wrap all the files in the manifest together. How do I get this to work?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
CamelCamelCamel
  • 5,200
  • 8
  • 61
  • 93

1 Answers1

1

You could call the Sprockets require directive inside of your CoffeeScript file to require the code from another file.

#= require path/to/other/file

Otherwise you could also configure Sprockets to compile your CoffeeScript using the bare option, but it's not recommended.

See "How can I use option “--bare” in Rails 3.1 for CoffeeScript?" for more information.

Community
  • 1
  • 1
Sandro
  • 4,761
  • 1
  • 34
  • 41