hubl/Makefile

59 lines
1.2 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
clean:
git clean -fXd
install: node_modules copy_lib submodules
submodules:
git submodule init
git submodule update
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
serve:
node server
# npm
node_modules:
npm install
# vendor lib
copy_lib:
@node copy_lib.js
# pug
2018-10-05 09:37:48 +00:00
$(DIST_DIR)/index.html: src/index.pug $(wildcard src/*.pug src/*/*.pug)
2018-09-28 19:20:15 +00:00
@echo pug: $< ➜ $@
@node_modules/.bin/pug --pretty $< --out $(dir $@) || touch $@
# sass
2018-10-05 09:37:48 +00:00
$(DIST_DIR)/styles/index.css: src/styles/index.scss $(wildcard 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-05 09:37:48 +00:00
$(DIST_DIR)/%.js: src/%.js
2018-09-28 19:20:15 +00:00
@echo babel: $< ➜ $@
@mkdir -p $(dir $@)
@node_modules/.bin/babel $< --out-file $@ --source-maps || touch $@
2018-10-05 09:37:48 +00:00
sync:
rsync -rv www/* staging-app@ssh-staging-app.happy-dev.fr:~/staging-app.happy-dev.fr/
2018-09-28 19:20:15 +00:00
2018-10-05 09:37:48 +00:00
.PHONY: default install submodules copy_lib build watch serve clean