hubl/Makefile

67 lines
2.3 KiB
Makefile
Raw Normal View History

2018-10-05 09:37:48 +00:00
DIST_DIR := www
2018-09-28 19:20:15 +00:00
SCRIPT_SRC := $(wildcard src/scripts/*.js)
2018-10-05 09:37:48 +00:00
SCRIPT_DEST := $(SCRIPT_SRC:src/%=$(DIST_DIR)/%)
2018-09-28 19:20:15 +00:00
default: build
2018-10-05 09:37:48 +00:00
build: $(DIST_DIR)/index.html $(DIST_DIR)/styles/index.css $(SCRIPT_DEST)
2018-09-28 19:20:15 +00:00
watch:
@echo 'watching for change'
@echo 'press Ctrl+C to stop'
@while true; do \
$(MAKE) --silent build; \
sleep 0.5; \
done
# pug
2018-12-17 14:20:36 +00:00
$(DIST_DIR)/index.html: src/index.pug src/config.json $(wildcard src/*.pug src/*/*.pug)
@echo pug: $< ➜ $@
@export ENV="dev"; \
node_modules/.bin/pug --pretty $< --out $(dir $@) -O src/config.json || touch $@
# pug (prod)
$(DIST_DIR)/index.prod.html: src/index.pug src/config.json $(wildcard src/*.pug src/*/*.pug)
2018-09-28 19:20:15 +00:00
@echo pug: $< ➜ $@
2019-04-18 08:01:35 +00:00
2018-12-17 14:20:36 +00:00
@export ENV="prod"; \
node_modules/.bin/pug --pretty $< --out $(dir $@) -E prod.html -O src/config.json || touch $@
2018-09-28 19:20:15 +00:00
2019-04-18 08:01:35 +00:00
# pug (staging)
$(DIST_DIR)/index.staging.html: src/index.pug src/config.json $(wildcard src/*.pug src/*/*.pug)
@echo pug: $< ➜ $@
@export ENV="staging"; \
node_modules/.bin/pug --pretty $< --out $(dir $@) -E staging.html -O src/config.json || touch $@
2018-09-28 19:20:15 +00:00
# sass
2019-05-13 16:50:34 +00:00
$(DIST_DIR)/styles/index.css: src/styles/_index.scss $(wildcard src/*.scss src/*/*.scss src/*/*/*.scss src/*/*/*/*.scss)
2018-09-28 19:20:15 +00:00
@echo sass: $< ➜ $@
2018-10-05 09:37:48 +00:00
@node_modules/.bin/node-sass $< $@ --source-map true --source-map-contents || touch $@
2018-09-28 19:20:15 +00:00
# babel
2018-10-22 15:03:00 +00:00
$(DIST_DIR)/%.js: src/%.js .babelrc
2018-09-28 19:20:15 +00:00
@echo babel: $< ➜ $@
@mkdir -p $(dir $@)
@node_modules/.bin/babel $< --out-file $@ --source-maps || touch $@
2019-04-23 08:42:53 +00:00
buildstaging: build
$(MAKE) $(DIST_DIR)/index.staging.html
2018-10-17 21:04:03 +00:00
buildprod: build
2018-12-17 14:20:36 +00:00
$(MAKE) $(DIST_DIR)/index.prod.html
2018-10-12 17:11:13 +00:00
2019-04-18 08:01:35 +00:00
sync: buildstaging
rsync -rv www/* staging-app@ssh-staging-app.happy-dev.fr:~/staging-app.happy-dev.fr/ --exclude=www/index.html --exclude=www/index.prod.html --exclude=www/index.staging.html
rsync --no-R --no-implied-dirs www/index.staging.html staging-app@ssh-staging-app.happy-dev.fr:~/staging-app.happy-dev.fr/index.html
2018-10-18 18:06:43 +00:00
rsync -v www/.htaccess staging-app@ssh-staging-app.happy-dev.fr:~/staging-app.happy-dev.fr/
2018-09-28 19:20:15 +00:00
2019-04-23 08:42:53 +00:00
syncprod: buildprod
rsync -rv www/* alpha@ssh-alpha.happy-dev.fr:~/www/ --exclude=www/index.html --exclude=www/index.prod.html --exclude=www/index.staging.html
2019-04-18 08:01:35 +00:00
rsync --no-R --no-implied-dirs www/index.prod.html alpha@ssh-alpha.happy-dev.fr:~/www/index.html
rsync -v www/.htaccess alpha@ssh-alpha.happy-dev.fr:~/www/
2019-05-14 12:03:11 +00:00
.PHONY: default build watch sync syncprod buildstaging buildprod