Coffeescript Local Development & Require.js Plugin Performance
We would like to experiment with coffeescript and eventually convert all js code to coffee. Since we are using require.js I guess the easiest approach to loading for local development is to use require.js coffeescript plugin and adjust module loading accordingly, like
var myModule = require('cs!myModule');
Is this procedure, which, if my understanding is correct, assumes that all .coffee files are compiled on the fly, risk quickly becoming a performance issue and therefore can significantly slow down the development process?
If so, what option do you suggest?
source to share
I wonder if this will be a performance issue depends a lot on the size and structure of your application. In my experience the coffeescript builder doesn't take long, but I've only used it with fairly small projects (5-10 files, 50 lines each).
Since Require.js allows you to easily split your code into modules that will only load when you need them, you might be able to structure your application to load and compile only a few coffeescript files for each page load.
The only alternative I've tried is to run the coffeescript compiler from the command line in view mode. In this mode, it will watch your coffeescript files and then compile them to javascript whenever it detects changes. (Though aside, I found this was not ideal either - the compiler sometimes seems to stop looking at my folder, leaving me scratching my head for a few minutes, why my changes didn't make a difference)
Personally, I would only recommend using the require.js coffeescript plugin for development - if it becomes too much of a performance issue then you can just switch to using the command line compiler in view mode. Converting the required calls is just a simple search and replace case that I would imagine.
source to share