diff --git a/Makefile b/Makefile index a5a283a..7492640 100644 --- a/Makefile +++ b/Makefile @@ -27,11 +27,7 @@ $(PUBLIC_DIR)/index.html: $(FRONTEND_DIR)/index.html $(PUBLIC_DIR) cp $< $@ $(FRONTEND_DIR)/elm.min.js: -ifeq ($(DEBUG),1) - make -C $(FRONTEND_DIR) DEBUG=1 -else ifeq ($(RELEASE),1) - make -C $(FRONTEND_DIR) RELEASE=1 -endif + make -C $(FRONTEND_DIR) .PHONY: frontend backend @@ -47,10 +43,10 @@ serve: frontend backend ifeq ($(DEBUG),1) RUST_LOG=info,actix_web=debug $(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml else ifeq ($(RELEASE),1) - $(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml + $(CARGO_RUN) --release --manifest-path=$(BACKEND_DIR)/Cargo.toml endif clean: rm -rf $(PUBLIC_DIR)/* rm -rf $(BACKEND_DIR)/target - + make -C $(FRONTEND_DIR) clean diff --git a/README.md b/README.md index 3c8868c..007244b 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,12 @@ Example demonstrating how one might architect a single page application Elm app. -# Dependencies MacOS -You will need to have rust and cargo installed on MacOS. - -```bash -brew install node elm -npm install -g uglify-js@2.4.11 -``` # Building -`make serve` or `make serve_debug` +```bash +nix-shell -p elmPackages.elm cargo uglify-js +make serve RELEASE=1 # can also do DEBUG=1 instead +``` Now open `http://127.0.0.1:8080` in your browser. diff --git a/frontend/Makefile b/frontend/Makefile index a7c0b10..bd0b024 100644 --- a/frontend/Makefile +++ b/frontend/Makefile @@ -16,4 +16,7 @@ ifeq ($(DEBUG),1) ./build.sh --debug src/Main.elm else ifeq ($(RELEASE),1) ./build.sh --optimize src/Main.elm -endif \ No newline at end of file +endif + +clean: + rm elm.js elm.min.js diff --git a/frontend/build.sh b/frontend/build.sh index e64570f..e357801 100755 --- a/frontend/build.sh +++ b/frontend/build.sh @@ -14,8 +14,8 @@ else exit 1 fi -uglifyjs elm.js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters=true,keep_fargs=false,unsafe_comps=true,unsafe=true,passes=2' --output=elm.js -uglifyjs elm.js --mangle --output=elm.js +uglifyjs elm.js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters=true,keep_fargs=false,unsafe_comps=true,unsafe=true,passes=2' --output elm.js +uglifyjs elm.js --mangle --output $min echo "Compiled size: $(wc -c < $js) bytes ($js)" echo "Minified size: $(wc -c < $min) bytes ($min)"