Skip to content

Instantly share code, notes, and snippets.

@davetron5000
Created May 25, 2015 17:25
Show Gist options
  • Save davetron5000/03bc5d0a8792b80598ee to your computer and use it in GitHub Desktop.
Save davetron5000/03bc5d0a8792b80598ee to your computer and use it in GitHub Desktop.

Suppose I have a bunch of CoffeeScript files:

> ls src
foo.coffee    bar.coffee    baz.coffee

I want to produce the following for deploying:

  • a concatenated, gzip'ed, hashed file suitable for serving up in production
  • a source map
  • documentation
  • unit test coverage

Thus, I need a build pipeline like so:

foo.coffee  |
bar.coffee  |>--->all.coffee--->all.js--->all.min.js--->all.min.gz--->all.min.9845iegiwfhfgaksjfsad.gz
baz.coffee  |               \--->all.sourcemap
                             \---->all/*.html
                              \
foo_spec.coffee  |             \---v
bar_spec.coffee  |>------------------>coverage.json
baz_spec.coffee  |

If this is modeled as a build pipeline, i.e what make from 1970 was created to do, the build will know that if I change foo_spec.coffee and wish to re-calculate my test coverage, I do not need to concatenate my source files, as they have not changed.

This is obviously simplified, but in a real app, there would a lot of build artifacts that depend on one another, and you don't wanto rebuild the world everytime you run the build or everytime you change one file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment