public
Created

JavaScript Makefile with concatenation, minimiser

  • Download Gist
Makefile
Makefile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
# description: build script for project libraries, external libraries including jslint
# used on The Big Art Mob web app
#
# usage: `make all` or `make lint`
#`
# requirements: node + npm for uglify-js, jslint.
 
 
# App.js
#
APP = ./js/build/app.js
APP-MIN = ./js/build/app.min.js
 
APP-SRC = ./js/app.js
 
# BOM Framework
#
BOM = ./js/build/BOM.js
BOM-MIN = ./js/build/BOM.min.js
 
BOM-SRC = ./js/BOM.js ./js/BOM.Models.js ./js/BOM.Collections.js ./js/BOM.Views.js ./js/BOM.Views.Cells.js ./js/BOM.Views.Panels.js ./js/BOM.Views.Modals.js ./js/BOM.Views.Lists.js ./js/BOM.Views.Maps.js ./js/BOM.factory.js
 
# Libraries
#
LIB = ./js/build/BOM.libs.js
LIB-MIN = ./js/build/BOM.libs.min.js
 
LIB-SRC = ./js/libs/ICanHaz.min.js ./js/libs/spin.min.js ./js/libs/jquery.effects.slide.js ./js/libs/jquery.iframe-post-form.js ./js/libs/jquery.form.js ./js/libs/jquery.cookie.js ./js/libs/jquery.scrollTo-1.4.2-min.js ./js/libs/jQuery-Validation-Engine/js/languages/jquery.validationEngine-en.js ./js/libs/jQuery-Validation-Engine/js/jquery.validationEngine.js ./js/libs/flowPlayer/flowplayer-3.0.6.min.js ./js/libs/underscore.js ./js/libs/backbone.js ./js/libs/nice_alert.js ./js/libs/json2.js ./js/libs/jquery-gmap3-3.3/gmap3.js ./js/libs/infobox.js ./js/libs/infobox_packed.js ./js/libs/markermanager_packed.js ./js/libs/markerclusterer_packed.js ./js/libs/StyledMarker.js
 
#
# all
#
 
all: clean build min
 
#
# Lint
#
 
lint:
./node_modules/.bin/jslint --white false --onevar false $(BOM-SRC)
#
# Clean
#
 
clean:
rm -f $(APP)
rm -f $(BOM)
rm -f $(LIB)
rm -f $(APP-MIN)
rm -f $(BOM-MIN)
rm -f $(LIB-MIN)
 
#
# Build
#
build: build-app build-bom build-lib
build-app: $(APP-SRC)
cat $^ > $(APP)
build-bom: $(BOM-SRC)
cat $^ > $(BOM)
build-lib: $(LIB-SRC)
cat $^ > $(LIB)
 
#
# Min
#
 
min: min-app min-src min-lib
 
min-app:
$(foreach var, $(APP-SRC), ./node_modules/.bin/uglifyjs --no-mangle $(var) >>$(APP-MIN);))
 
min-src:
$(foreach var, $(BOM-SRC), ./node_modules/.bin/uglifyjs --no-mangle $(var) >>$(BOM-MIN);))
 
min-lib:
$(foreach var, $(LIB-SRC), ./node_modules/.bin/uglifyjs --no-mangle $(var) >>$(LIB-MIN);))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.