Created
May 11, 2011 13:58
-
-
Save StanAngeloff/966484 to your computer and use it in GitHub Desktop.
Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build: | |
@@cat one.js two.js three.js | awk '{ if ($$0 ~ /<!--#include/) { match($$0, /<!--#include[[:space:]]file="([^"]+)"[[:space:]]-->/, captures); system(sprintf("cat '%s'", captures[1])) } else { print; } }' | uglifyjs -o out.min.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
from within your scripts directory.
What it does?
The Makefile reads three files
one.js
,two.js
andthree.js
(in this order) and concatenates them in one. The result is processed so any Server-Side includes are replaced. The final output is passed to UglifyJS.Example
one.js:
lib.js:
two.js: empty
three.js: empty
Why?
Server-Side includes are a great way to minimize your work while developing a component. No need to have Watchr monitoring and running scripts on the background for you, just let Apache deal with it.
When it comes time to deploy, run
make
and commit the production files.