r/coffeescript • u/DebuggingPanda • Apr 05 '14
Help a beginner: Coffeescript project structure?
Hi!
I am new to coffeescript and want to know, how I should organize my coffee files and structure my project. (site-note: I'm mostly a C++ programmer).
Are there any recommendations how to structure a project? I just wanted to create another file, which contains some function definitions. Now I want to "use" those definitions in my main file. Is there any type of include-system? Module-system? Or should I just pass "-j" to the compiler and he merges all files?
And when should I split my files? How do I design moduls and split my code? Do I create a file for every class? Are classes even used?
I guess I think of everything to much in a C++ way... I would appreciate help :)
View all comments
Show parent comment
2
u/[deleted] Apr 14 '14
I know this post is a week old, but in my opinion the best way to do it is to pretend you're writing Node.JS and use their 'require' and module system. http://nodejs.org/api/modules.html
Then you call browserify on your main file and it will load everything in a js file for you.
Anyway, the AMD vs require.js vs browserify debate hasn't been resolved by the JS community yet. It'll converge on one eventually.