Skip to content

Commit b390a5f

Browse files
committed
Add serve command to build and serve static files
- needed an http server to serve 'wasm' extension - I typically use nginx in one-time docker container run mapped to local directory to serve files - needed to add custom nginx config to serve "application/wasm" mime type - interested in adding info to Yew docs, looked at website which I then looked at Rollup example source - they recommend using python http server - found myself on Rust WASM RFCs github page with "watch and serve" command RFC - rustwasm/rfcs#10
1 parent 8aaf1e5 commit b390a5f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/target
22
**/*.rs.bk
33
Cargo.lock
4-
bin/
54
pkg/
65
wasm-pack.log

bin/serve.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env sh
2+
3+
wasm-pack build --target web
4+
5+
cd pkg
6+
echo "Server started at http://localhost:8000 from $PWD"
7+
docker run -p 8000:80 --rm -v "$HOME/.profile_sources/server/custom-types.conf":/etc/nginx/conf.d/custom-types.conf:ro -v "$PWD":/usr/share/nginx/html:ro nginx:alpine

0 commit comments

Comments
 (0)