Skip to content

Commit

Permalink
[examples/physics] add demo for using jsdelivr instead of a bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
codefrau committed Mar 18, 2024
1 parent 39e812a commit 33a9e72
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
27 changes: 27 additions & 0 deletions examples/physics/jsdelivr.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<html>
<head>
<title>Worldcore Physics</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta charset="utf-8">
<style>
body {
overflow: hidden;
background: rgb(30, 30, 30);
}
</style>
<!-- THIS HTML FILE WORKS WITHOUT A BUNDLER -->
<script type="importmap">
{
"imports": {
"./src/Views": "./src/Views.js",
"./src/Models": "./src/Models.js",
"@croquet/worldcore": "https://esm.run/@croquet/worldcore@pre",
"@croquet/worldcore-rapier": "https://esm.run/@croquet/worldcore-rapier@pre"
}
}
</script>
<script type="module" src="index.js"></script>
</head>
<body>
</body>
</html>
3 changes: 2 additions & 1 deletion examples/physics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"private": true,
"scripts": {
"start": "webpack serve --no-live-reload --no-hot --mode development --devtool source-map",
"build": "webpack --mode production"
"build": "webpack --mode production",
"post-build": "cp -v jsdelivr.html dist/"
},
"author": "Croquet Corporation",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/physics/src/Views.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Views

import { ViewRoot, Pawn, mix, InputManager, PM_ThreeVisible, ThreeRenderManager, PM_Spatial, THREE, PM_Smoothed, toRad, m4_rotation, m4_multiply,
WidgetManager2, Widget2, ButtonWidget2, TAU, m4_translation, v3_transform, ThreeInstanceManager,
Widget2, ButtonWidget2, TAU, m4_translation, v3_transform, ThreeInstanceManager,
PM_ThreeInstanced, ViewService } from "@croquet/worldcore";


Expand Down
1 change: 1 addition & 0 deletions scripts/build-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ for DIR in tutorials examples ; do
echo "Commit: $COMMIT" > build.log
npm run build >> build.log 2>&1
BUILD_ERROR=$?
npm run post-build --if-present >> build.log 2>&1
cat build.log
DATE=$(git ls-tree -r --name-only HEAD -- . | grep -v 'package.*json' | xargs -n 1 git log -1 --format='%ad' --date=format:'%Y-%m-%d' | sort | tail -1)
if [ $BUILD_ERROR -eq 0 ] ; then
Expand Down

0 comments on commit 33a9e72

Please sign in to comment.