diff --git a/.gitignore b/.gitignore
index 1ef7b007e..d1fdd53e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,7 +34,7 @@ xcuserdata
examples/*.o.tmp
examples/*.out.js
examples/*.out.wasm
-examples/example_emscripten_opengl3/example_emscripten_opengl3.*
+examples/example_emscripten_opengl3/web/*
## JetBrains IDE artifacts
.idea
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index b03d688d6..b67f33342 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -129,6 +129,7 @@ Other Changes:
- Examples: Apple+Metal: Consolidated/simplified to get closer to other examples. (#3543) [@warrenm]
- Examples: Apple+Metal: Forward events down so OS key combination like Cmd+Q can work. (#3554) [@rokups]
- Examples: Emscripten: Renamed example_emscripten/ to example_emscripten_opengl3/. (#3632)
+- Examples: Emscripten: Added 'make serve' helper to spawn a web-server on localhost. (#3705) [@Horki]
- Examples: DirectX12: Move ImGui::Render() call above the first barrier to clarify its lack of effect on the graphics pipe.
- CI: Fix testing for Windows DLL builds. (#3603, #3601) [@iboB]
- Docs: Split examples/README.txt into docs/BACKENDS.md and docs/EXAMPLES.md improved them.
diff --git a/examples/example_emscripten_opengl3/.gitignore b/examples/example_emscripten_opengl3/.gitignore
deleted file mode 100644
index ed3df07e2..000000000
--- a/examples/example_emscripten_opengl3/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore Web Instance
-web/
diff --git a/examples/example_emscripten_opengl3/Makefile b/examples/example_emscripten_opengl3/Makefile
index 33bc9d46a..ff28ef5c0 100644
--- a/examples/example_emscripten_opengl3/Makefile
+++ b/examples/example_emscripten_opengl3/Makefile
@@ -7,16 +7,16 @@
# (On Windows, you may need to execute emsdk_env.bat or encmdprompt.bat ahead)
#
# Running `make` will produce three files:
-# - example_emscripten_opengl3.html
-# - example_emscripten_opengl3.js
-# - example_emscripten_opengl3.wasm
+# - web/index.html
+# - web/index.js
+# - web/index.wasm
#
# All three are needed to run the demo.
CC = emcc
CXX = em++
WEB_DIR = web
-EXE = $(WEB_DIR)/example_emscripten_opengl3.html
+EXE = $(WEB_DIR)/index.html
IMGUI_DIR = ../..
SOURCES = main.cpp
SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp
@@ -89,4 +89,4 @@ $(EXE): $(OBJS) $(WEB_DIR)
$(CXX) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
clean:
- rm -rf $(EXE) $(OBJS) *.js *.wasm *.wasm.pre $(WEB_DIR)
+ rm -rf $(OBJS) $(WEB_DIR)
diff --git a/examples/example_emscripten_opengl3/README.md b/examples/example_emscripten_opengl3/README.md
index 3f0176b1f..fddd9229b 100644
--- a/examples/example_emscripten_opengl3/README.md
+++ b/examples/example_emscripten_opengl3/README.md
@@ -1,4 +1,3 @@
-
## How to Build
- You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions
@@ -9,10 +8,13 @@
## How to Run
To run on a local machine:
-- Generally you may need a local webserver. Quoting [https://emscripten.org/docs/getting_started](https://emscripten.org/docs/getting_started/Tutorial.html#generating-html):
+- `make serve` will use Python3 to spawn a local webserver, you can then browse http://localhost:8000 to access your build.
+- Otherwise, generally you will need a local webserver:
+ - Quoting [https://emscripten.org/docs/getting_started](https://emscripten.org/docs/getting_started/Tutorial.html#generating-html):
_"Unfortunately several browsers (including Chrome, Safari, and Internet Explorer) do not support file:// [XHR](https://emscripten.org/docs/site/glossary.html#term-xhr) requests, and can’t load extra files needed by the HTML (like a .wasm file, or packaged file data as mentioned lower down). For these browsers you’ll need to serve the files using a [local webserver](https://emscripten.org/docs/getting_started/FAQ.html#faq-local-webserver) and then open http://localhost:8000/hello.html."_
-- Emscripten SDK has a handy `emrun` command: `emrun web/example_emscripten_opengl3.html --browser firefox` which will spawn a temporary local webserver (in Firefox). See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
-- Otherwise you may use Python builtin webserver: `python -m http.server -d web` in Python 3 (or run shortcut `make serve`) or `cd web && python -m SimpleHTTPServer` in Python 2. After doing that, you can visit http://localhost:8000/.
+ - Emscripten SDK has a handy `emrun` command: `emrun web/example_emscripten_opengl3.html --browser firefox` which will spawn a temporary local webserver (in Firefox). See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
+ - You may use Python 3 builtin webserver: `python -m http.server -d web` (this is what `make serve` uses).
+ - You may use Python 2 builtin webserver: `cd web && python -m SimpleHTTPServer`.
## Obsolete features: