refactoring
This commit is contained in:
56
Makefile
Normal file
56
Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
SCRIPT_SRC := $(wildcard src/scripts/*.js)
|
||||
|
||||
SCRIPT_DEST := $(SCRIPT_SRC:src/%=www/%)
|
||||
|
||||
default: build
|
||||
|
||||
clean:
|
||||
git clean -fXd
|
||||
|
||||
|
||||
install: node_modules copy_lib submodules
|
||||
|
||||
submodules:
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
build: www/index.html www/styles/index.css $(SCRIPT_DEST)
|
||||
|
||||
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
|
||||
www/index.html: src/index.pug $(wildcard src/*.pug src/*/*.pug)
|
||||
@echo pug: $< ➜ $@
|
||||
@node_modules/.bin/pug --pretty $< --out $(dir $@) || touch $@
|
||||
|
||||
# sass
|
||||
www/styles/index.css: src/styles/index.scss $(wildcard src/*.scss src/*/*.scss)
|
||||
@echo sass: $< ➜ $@
|
||||
@node_modules/.bin/node-sass $< $@ --source-map true || touch $@
|
||||
|
||||
# babel
|
||||
www/%.js: src/%.js
|
||||
@echo babel: $< ➜ $@
|
||||
@mkdir -p $(dir $@)
|
||||
@node_modules/.bin/babel $< --out-file $@ --source-maps || touch $@
|
||||
|
||||
.PHONY: default install submodules copy_lib build watch serve clean
|
||||
|
||||
|
Reference in New Issue
Block a user