drastically improve build scripts
This commit is contained in:
parent
7a59aab77d
commit
db00669800
10
Makefile
10
Makefile
|
@ -27,11 +27,7 @@ $(PUBLIC_DIR)/index.html: $(FRONTEND_DIR)/index.html $(PUBLIC_DIR)
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
$(FRONTEND_DIR)/elm.min.js:
|
$(FRONTEND_DIR)/elm.min.js:
|
||||||
ifeq ($(DEBUG),1)
|
make -C $(FRONTEND_DIR)
|
||||||
make -C $(FRONTEND_DIR) DEBUG=1
|
|
||||||
else ifeq ($(RELEASE),1)
|
|
||||||
make -C $(FRONTEND_DIR) RELEASE=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: frontend backend
|
.PHONY: frontend backend
|
||||||
|
|
||||||
|
@ -47,10 +43,10 @@ serve: frontend backend
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
RUST_LOG=info,actix_web=debug $(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
RUST_LOG=info,actix_web=debug $(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
||||||
else ifeq ($(RELEASE),1)
|
else ifeq ($(RELEASE),1)
|
||||||
$(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
$(CARGO_RUN) --release --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
||||||
endif
|
endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(PUBLIC_DIR)/*
|
rm -rf $(PUBLIC_DIR)/*
|
||||||
rm -rf $(BACKEND_DIR)/target
|
rm -rf $(BACKEND_DIR)/target
|
||||||
|
make -C $(FRONTEND_DIR) clean
|
||||||
|
|
12
README.md
12
README.md
|
@ -2,16 +2,12 @@
|
||||||
Example demonstrating how one might architect a single page application
|
Example demonstrating how one might architect a single page application
|
||||||
Elm app.
|
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
|
# 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.
|
Now open `http://127.0.0.1:8080` in your browser.
|
||||||
|
|
||||||
|
|
|
@ -16,4 +16,7 @@ ifeq ($(DEBUG),1)
|
||||||
./build.sh --debug src/Main.elm
|
./build.sh --debug src/Main.elm
|
||||||
else ifeq ($(RELEASE),1)
|
else ifeq ($(RELEASE),1)
|
||||||
./build.sh --optimize src/Main.elm
|
./build.sh --optimize src/Main.elm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm elm.js elm.min.js
|
||||||
|
|
|
@ -14,8 +14,8 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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 --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 --mangle --output $min
|
||||||
|
|
||||||
echo "Compiled size: $(wc -c < $js) bytes ($js)"
|
echo "Compiled size: $(wc -c < $js) bytes ($js)"
|
||||||
echo "Minified size: $(wc -c < $min) bytes ($min)"
|
echo "Minified size: $(wc -c < $min) bytes ($min)"
|
||||||
|
|
Loading…
Reference in a new issue