You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

ROOT=$(shell pwd)
SOURCE_ASSETS_IMG_DIR=frontend/assets/img
SOURCE_ASSETS_IMG_FILES=$(wildcard frontend/assets/img/*)
TARGET_ASSETS_IMG_DIR=frontend/compiled/img
TARGET_CSS_DIR=frontend/compiled/css
TARGET_CSS_FILE=$(TARGET_CSS_DIR)/style.css
4 years ago
TARGET_JS_DIR=$(BACKEND_ASSETS_DIR)/js
TARGET_JS_FILE=$(TARGET_JS_DIR)/app.js
SOURCE_ELM_FILES=$(wildcard frontend/src/*.elm)
SOURCE_SASS_FILE=frontend/assets/sass/style.scss
4 years ago
INDEX_FILE=backend/resources/public/index.html
.PHONY: compile
compile: $(TARGET_JS_FILE) $(TARGET_CSS_FILE) $(TARGET_ASSETS_IMG_DIR)
$(TARGET_JS_FILE): $(SOURCE_ELM_FILES)
mkdir -p $(TARGET_JS_DIR)
4 years ago
cd frontend && elm make src/Main.elm --output $(ROOT)/$(TARGET_JS_FILE) --optimize
$(TARGET_CSS_FILE): $(SOURCE_SASS_FILE)
mkdir -p $(TARGET_CSS_DIR)
sassc --style compressed $(SOURCE_SASS_FILE) > $(TARGET_CSS_FILE)
$(TARGET_ASSETS_IMG_DIR): $(SOURCE_ASSETS_IMG_FILES)
mkdir -p $(TARGET_ASSETS_IMG_DIR)
cp $(SOURCE_ASSETS_IMG_DIR)/* $(TARGET_ASSETS_IMG_DIR)
4 years ago
.PHONY: compile-debug
compile-debug:
cd frontend && elm make src/Main.elm --output $(ROOT)/$(APP_JS) --debug
sassc $(SOURCE_SASS_FILE) > $(TARGET_CSS_FILE)
.PHONY: elm-live
elm-live:
4 years ago
cd frontend && \
elm-live src/Main.elm \
--pushstate \
--start-page=../$(INDEX_FILE) \
-- \
--debug \
--output=compiled/js/app.js
.PHONY: assets-live
assets-live:
while sleep 1; do make -s $(TARGET_CSS_FILE); make -s $(TARGET_ASSETS_IMG_DIR); done