0

I'm building a Rails application that is almost entirely CoffeeScript upfront. The user will never wait for a page redirect because literally everything happens on the front page (a la Twitter).

Now I've had to put all of my CoffeeScript into one file because my jQuery onLoad is complex and, while in production it will be compiled to one JS file, in testing this is not the case.

How can I either import CoffeeScript from other files in development or organize my CoffeeScript so I'm not piling 500 lines into one file (when those 500 lines contain 5/6 distinct domains)?

I have used import in SCSS to do the same thing for my stylesheets, but CS is proving a bit trickier.

1 Answer 1

2

The asset pipeline allows you to require different files into one file, which keeps them separate in development and compiles them to one file in production. Check out the instructions on Manifest files and Directives

Also, have you looked into RequireJS? It can work in or outside of Rails and might be the sort of thing you need.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.