A utility for combining coffeescript files and resolving their dependencies.
coffeescript-concat is a utility that preprocesses and concatenates CoffeeScript source files.
coffeescript-concat performs 4 operations:
Automatically puts parent classes in an inheritance chain in the correct order
Allows you to specify that a class from another file needs to be included before another file.
#= require Classname directive is encountered, coffeescript-concat will find the file containing that class, preprocess it, and put it above the including class.
Allows you to specifiy that a file needs to be included before another file.
#= require <FileName> or
#=require <FileName.coffee> directive is encountered, coffeescript-concat will find the file, preprocess it, and put it above the including class.
Allows you to refer to external classes that will be available at runtime
#= extern Classname directive is encountered, coffeescript-concat
will assume that class exists.
How does coffeescript-concat find the classes and files? By specifying include directories, you can tell coffeescript where to look. If it can't find the needed file in any of the include directories, it will let you know.
npm install -g coffeescript-concat
coffeescript-concat -I /my/include/directory -I includeDir2 A.coffee B.coffee -o output.coffee
Using CoffeeScript directly:
coffee coffeescript-concat.coffee -I /my/include/directory -I includeDir2 A.coffee B.coffee -o output.coffee
This will preprocess and concatenate This.coffee, That.coffee, and TheOther.coffee along with any classes they require and output the resulting code into output.coffee. If you don't specify an output file (-o), coffeescript-concat prints the output to stdout so that you can easily write it to a file or pipe it to another utility for further processing.