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?
You could call the Sprockets
requiredirective inside of your CoffeeScript file to require the code from another 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.