Skip to main content

require()"ing a CoffeeScript file from a JavaScript file or REPL



I'm using Node.js and wanting to incorporate CoffeeScript into my workflow. I have two use-cases:





  1. I want to be able to write JavaScript files which require() CoffeeScript modules



  2. I want to be able to load CoffeeScript modules from within the node REPL







For case #1 I can just compile from .coffee to .js and require() the .js module, as a workaround. For case #2 right now I'm eval()'ing the output of coffee-script.compile().





Is there a better, more unified way to do this?



Source: Tips4all

Comments

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?