Disable offline caching during development

This makes development easier as always the latest version is used.
This commit is contained in:
Alex Kazik 2022-07-07 19:09:31 +02:00 committed by Emil Ernerfeldt
parent 1ea0172f94
commit 3649d3453d
4 changed files with 10 additions and 5 deletions

View file

@ -78,6 +78,10 @@ The finished web app is found in the `docs/` folder (this is so that you can eas
You can test the template app at <https://emilk.github.io/eframe_template/>.
### Web testing/development
Open `index.html#dev` to disable caching, which makes development easier.
## Updating egui
As of 2022, egui is in active development with frequent releases with breaking changes. [eframe_template](https://github.com/emilk/eframe_template/) will be updated in lock-step to always use the latest version of egui.

View file

@ -66,12 +66,12 @@ echo "Finished: docs/${CRATE_NAME_SNAKE_CASE}.wasm"
if [[ "${OPEN}" == true ]]; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux, ex: Fedora
xdg-open http://localhost:8080/index.html
xdg-open http://localhost:8080/index.html#dev
elif [[ "$OSTYPE" == "msys" ]]; then
# Windows
start http://localhost:8080/index.html
start http://localhost:8080/index.html#dev
else
# Darwin/MacOS, or something else
open http://localhost:8080/index.html
open http://localhost:8080/index.html#dev
fi
fi

View file

@ -159,7 +159,8 @@
<!--Register Service Worker-->
<script>
if ('serviceWorker' in navigator) {
// We disable caching during development so that we always view the latest version.
if ('serviceWorker' in navigator && window.location.hash !== "#dev") {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js');
});

View file

@ -6,7 +6,7 @@ PORT=8080
# Starts a local web-server that serves the contents of the `doc/` folder,
# which is the folder to where the web version is compiled.
echo "open http://localhost:$PORT"
echo "open http://localhost:$PORT/index.html#dev"
(cd docs && basic-http-server --addr 127.0.0.1:$PORT .)
# (cd docs && python3 -m http.server $PORT --bind 127.0.0.1)