|
| 1 | +--- |
| 2 | +id: client-asset-tunnelling |
| 3 | +title: Client Asset Tunnelling |
| 4 | +--- |
| 5 | + |
| 6 | +The best way to work on the Dark client is by building it against the production |
| 7 | +Dark APIs. In the future as we move more part of the editor to be built in Dark, |
| 8 | +it will become the only way to work on the Dark client. |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +## Host the static assets locally |
| 13 | + |
| 14 | +First, you'll need a web server on your machine to host the static assets. The |
| 15 | +editor's build artifacts are hosted in `backend/static`, so you'll need to host |
| 16 | +that directory. Many tools can be used to accomplish this task - here's how to |
| 17 | +do this with the [static-server](https://www.npmjs.com/package/static-server) |
| 18 | +npm package. |
| 19 | + |
| 20 | +- `cd backend/static` |
| 21 | +- `npx static-server --cors '*' --port [port]` |
| 22 | + |
| 23 | +You can choose any port available locally, and `--cors '*'` instructs the server |
| 24 | +to include `access-control-allow-origin: *` headers for all requests. |
| 25 | + |
| 26 | +## Create the tunnel to expose this web server to the internet |
| 27 | + |
| 28 | +Now, create a tunnel to expose the webserver to the internet. |
| 29 | + |
| 30 | +- Install [ngrok](https://ngrok.com) on your machine |
| 31 | +- `ngrok http [port]` to create the tunnel on the port where your webserver is |
| 32 | + serving the static assets |
| 33 | + |
| 34 | +Alternative tools include [localtunnel.me](https://localtunnel.me) and |
| 35 | +[Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/). |
| 36 | + |
| 37 | +## Register the tunnel in the Editor |
| 38 | + |
| 39 | +Finally, use the tunnel in the editor: |
| 40 | + |
| 41 | +- Go to Settings (from the icon in the top-right of the editor) |
| 42 | +- Go to the Contributing tab |
| 43 | +- Enter the hostname provided to you by your tunnel |
| 44 | +- Choose to "Use tunneled assets" |
| 45 | + |
| 46 | +This will cause a refresh of the editor, with static assets being served through |
| 47 | +the tunnel from your local dev environment. |
0 commit comments