Last active
August 29, 2015 14:04
-
-
Save dmitry-vsl/47c216739b770c7d7e42 to your computer and use it in GitHub Desktop.
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
coffeelint=./node_modules/coffeelint/bin/coffeelint -f coffeelint.json | |
coffee=./node_modules/coffee-script/bin/coffee | |
handlebars=./node_modules/handlebars/bin/handlebars | |
COFFEE=$(shell find app -type f -name '*.coffee') | |
JS=$(patsubst app/%.coffee, public/js/%.js, $(COFFEE)) | |
SCSS=$(shell find stylesheets -type f -name '*.scss') | |
CSS=$(patsubst stylesheets/%.scss, public/css/%.css, $(SCSS)) | |
HBS=$(shell find templates -name '*.hbs') | |
TEMPLATES=public/templates/templates.js | |
STATIC_SOURCE=$(shell find static -type f) | |
STATIC_TARGET=$(patsubst static/%, public/%, $(STATIC_SOURCE)) | |
VENDOR_JS=$(shell find vendor -type f -name '*.js') | |
VENDOR_CSS=$(shell find vendor -type f -name '*.css') | |
VENDOR_JS_PUBLIC=$(patsubst vendor/%.js, public/js/libs/%.js, $(VENDOR_JS)) | |
VENDOR_CSS_PUBLIC=$(patsubst vendor/%.css, public/css/%.css,$(VENDOR_CSS)) | |
public/js/%.js : app/%.coffee | |
# first check with coffeelint | |
$(coffeelint) $< | |
# if ok then compile | |
if [ $$? -eq 0 ] ; then $(coffee) -c -o $(@D) $< ; fi | |
public/css/%.css : stylesheets/%.scss | |
compass compile --css-dir ../public/css stylesheets $< | |
public/% : static/% | |
@mkdir -p $(@D) | |
cp $< $@ | |
public/js/libs/% : vendor/% | |
@mkdir -p $(@D) | |
cp $< $@ | |
public/css/% : vendor/% | |
@mkdir -p $(@D) | |
cp $< $@ | |
$(TEMPLATES): $(HBS) | |
@mkdir -p $(@D) | |
$(handlebars) $^ -a -e hbs -r templates -f $(TEMPLATES) | |
copy_vendor: $(VENDOR_JS_PUBLIC) $(VENDOR_CSS_PUBLIC) | |
copy_dev_config: | |
cp public/js/target-config/development.js public/js/target-config.js | |
copy_prod_config: | |
cp public/js/target-config/production.js public/js/target-config.js | |
all: $(JS) $(CSS) $(TEMPLATES) $(STATIC_TARGET) | |
dev: all copy_dev_config | |
release: all copy_prod_config | |
watch: | |
while true; do \ | |
inotifywait -e CLOSE_WRITE -r templates stylesheets app ; \ | |
make dev ; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment