Currently the project employs a standalone Grunt task for compiling the CoffeeScript sources to JavaScript. For production, the JS sources are then optimized into a single file. I recently learned that this can alternatively be tackled using the require-cs AMD plugin. It dynamically compiles in the browser during development, but it can compile ahead of time for the optimized build, so it does not introduce additional dependencies in production.
Advantages:
Probably yields a cleaner optimized build. The current solution repeatedly redefines CS support functions like extend at global scope.
Simplifies the Grunt task configuration.
Offloads compilation from the Grunt process to the browser, so probably a bit faster for development work.
Disadvantages:
Requires prefixing all module names with cs!.
Introduces another Bower dependency and corresponding RequireJS path configuration.
This is definitely a bycicle shed, since the existing solution is not clearly worse, so I'm giving this lowest priority. Still writing down the idea because it does illustrate the potential usefulness of RequireJS plugins.
Currently the project employs a standalone Grunt task for compiling the CoffeeScript sources to JavaScript. For production, the JS sources are then optimized into a single file. I recently learned that this can alternatively be tackled using the require-cs AMD plugin. It dynamically compiles in the browser during development, but it can compile ahead of time for the optimized build, so it does not introduce additional dependencies in production.
Advantages:
extend
at global scope.Disadvantages:
cs!
.This is definitely a bycicle shed, since the existing solution is not clearly worse, so I'm giving this lowest priority. Still writing down the idea because it does illustrate the potential usefulness of RequireJS plugins.