From 7c059342b5388855efbe42d46e8a22669836f103 Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Mon, 17 Feb 2020 02:15:44 +0000 Subject: [PATCH] - allow building without uglifying with `make build` --- Makefile | 13 ++++++++++--- src/static_handler.cr | 6 +++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 94d47c4..58f4aaf 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,19 @@ -build: +all: uglify | build + +uglify: yarn yarn uglify - shards install + +build: libs crystal build src/mango.cr --release --progress + +libs: + shards install + run: crystal run src/mango.cr --error-trace + clean: - rm mango rm -rf dist rm yarn.lock rm -rf node_modules diff --git a/src/static_handler.cr b/src/static_handler.cr index 6e41fab..890683a 100644 --- a/src/static_handler.cr +++ b/src/static_handler.cr @@ -5,7 +5,11 @@ require "./util" class FS extend BakedFileSystem - bake_folder "../dist" + {% if read_file? "./dist" %} + bake_folder "../dist" + {% else %} + bake_folder "../public" + {% end %} end class StaticHandler < Kemal::Handler