Is there a way to add preprocessing steps to the coffee compiler in a modular way?
Say, for example, that I wanted to augment the functionality of a all arrays and objects with underscore functions, allowing me to do something like testArray.first()
and have it compile to _.first(testArray)
This is something which would be very dangerous to do in plain javascript, as I would have to extend the Array.prototype
and might break functionality of the array in other libraries. It seems like it would be safe and fun to do with coffee-script, though.
It would be great if there was a way to do this in a way which is
- Modular - I could add multiple pre-processing steps, pulling from different projects which make programming more easy and elegant in different ways
- Integrated - I want to be able to change something in the configuration files of coffeescript so that I don't have to use a custom binary and replace the command in every single development tool which is calling the coffee compiler (for live compilation, etc).
Does this exist built into coffeescript? If not, it seems like it should. I'll bring it up with the developers if no-one has heard of it.