Skip to content

Instantly share code, notes, and snippets.

@bcantoni
Forked from pamelafox/Makefile
Created November 4, 2011 05:34
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 bcantoni/1338728 to your computer and use it in GitHub Desktop.
Save bcantoni/1338728 to your computer and use it in GitHub Desktop.
Closure/YUI/JsHint Makefile
# Makefile for JS/CSS:
# Uses Closure for JS compiling, YUI for CSS compiling, and JsHint for code quality checking
MAKEFLAGS = --no-print-directory --always-make
MAKE = make $(MAKEFLAGS)
BUILDDIR = ./.build
CLOSUREURL = http://closure-compiler.googlecode.com/files/compiler-latest.zip
CLOSUREDIR = $(BUILDDIR)/closure
CLOSUREFILE = $(CLOSUREDIR)/compiler.jar
YUIURL = http://yui.zenfs.com/releases/yuicompressor/yuicompressor-2.4.6.zip
YUIDIR = $(BUILDDIR)/yui
YUIFILE = $(YUIDIR)/yuicompressor-2.4.6/build/yuicompressor-2.4.6.jar
JSHINTURL = https://github.com/jshint/jshint/zipball/master
JSHINTDIR = $(BUILDDIR)/jshint
STATICDIR = ./application/static
downloadtools:
rm -Rf $(BUILDDIR);
mkdir $(BUILDDIR) $(CLOSUREDIR) $(YUIDIR) $(JSHINTDIR);
cd $(CLOSUREDIR); curl -L $(CLOSUREURL) > file.zip; tar -xf file.zip;
cd $(YUIDIR); curl -L $(YUIURL) > file.zip; tar -xf file.zip;
cd $(JSHINTDIR); curl -L $(JSHINTURL) > file.zip; tar -xf file.zip; cp -R jshint-*/* .; rm -rf jshint-*/;
clean:
rm -f $(STATICDIR)/js/libs.js \
$(STATICDIR)/css/all-web.css \
$(STATICDIR)/css/all-web-min.css;
jshint:
find $(STATICDIR)/js -name "*.js" -exec $(JSHINTDIR)/env/jsc.sh {} \;
cat:
cat \
$(STATICDIR)/js/libs/jquery.calendrical.js \
$(STATICDIR)/js/libs/jquery.autosuggest.js \
> $(STATICDIR)/js/libs.js;
cat \
$(STATICDIR)/css/autosuggest.css \
$(STATICDIR)/css/calendrical.css \
$(STATICDIR)/css/web.css \
> $(STATICDIR)/css/all-web.css;
compress:
java -jar $(CLOSUREFILE) --js_output_file=$(STATICDIR)/js/libs-min.js --js=$(STATICDIR)/js/libs.js;
sed -i '' "s/libs-min\.js?v=[0-9]*/libs-min\.js\?v=`date +%m%d%H%M`/" ./application/templates/base.html;
java -jar $(YUIFILE) $(STATICDIR)/css/all-web.css -o $(STATICDIR)/css/all-web-min.css;
sed -i '' "s/all-web-min\.css?v=[0-9]*/all-web-min\.css\?v=`date +%m%d%H%M`/" ./application/templates/base.html;
jscss:
$(MAKE) clean;
$(MAKE) jshint;
$(MAKE) cat;
$(MAKE) compress;
@skierpage
Copy link

tar doesn't operate on zip files (on Linux at least).

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