Skip to content

Instantly share code, notes, and snippets.

@liammclennan
Last active December 11, 2015 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liammclennan/4638943 to your computer and use it in GitHub Desktop.
Save liammclennan/4638943 to your computer and use it in GitHub Desktop.
Compile and concatenate CoffeeScript files

The following is a simple bash script to search a directory heirarchy for CoffeeScript files, concatenate them and compile them into a single javascript file.

First recursively print the paths to all CoffeeScript files:

find -L . -name "*.coffee"

Then print their contents:

find -L . -name "*.coffee" -exec cat {} \;

Then pipe the concatenated coffeescript into the CoffeeScript compiler. The output will be sent to stdout:

find -L . -name "*.coffee" -exec cat {} \; | coffee -sc

Finally, redirect stdout to a file:

find -L . -name "*.coffee" -exec cat {} \; | coffee -sc > compiled.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment