google / playground-elements

Serverless coding environments for the web.
BSD 3-Clause "New" or "Revised" License
542 stars 53 forks source link

How to use playground in hosting without NPM command scripting or as static file? #242

Open mentik opened 2 years ago

mentik commented 2 years ago

I would to host playground in my site as static web How to do this?

jacalata commented 1 year ago

I got this working as a single static html file after some trial and error, by setting importmaps for dependencies that required esm

You can see it working here: https://static-playground-imports.tiiny.site/

sukima commented 1 year ago

@jacalata That site doesn't work. Can you explain further?

I am also interested in this as well. How do you host this project?

sukima commented 1 year ago

I got something working.

  1. Recursive copy the examples/rollup/ folder to your dev folder.
  2. edit the package.json and change the dependency from file: to 0.18.1 (see patch below)
  3. Run npm install then npm run build
  4. Recursive copy dist/ to your static web server directory.
--- package.json.orig   2023-08-26 00:15:28.539482215 -0400
+++ package.json    2023-08-26 00:04:33.970240146 -0400
@@ -14,6 +14,6 @@
     "rollup-plugin-copy": "^3.4.0"
   },
   "dependencies": {
-    "playground-elements": "file:../.."
+    "playground-elements": "0.18.1"
   }
 }