Hey does anyone know where saved playgrounds are stored when running the playground locally? Is there a file(s) somewhere that I can back up or move from an old, broken build to a fresh working build for example? I’m starting to use the playground for prototyping things locally, but am nervous about being able to find and back up the saved PGs and so far can’t find them… Maybe @RaananW will know about it.
Hey there! When you have a playground in the local dev server, it is also saved to the playground server, so you can just use the playground hash as if it was a remote one
Thanks, but what if I want to move them to a different local dev server? EG if I break something and have to clone the repo and start fresh, is there a file(s) of saved playgrounds that I could just copy over?
EDIT: hmm from testing it seems the saved PGs are served using the newly cloned repo without copying anything over so I guess they’re stored globally somewhere outside of the Babylon directory… Would still be good to find where thou so they can be backed up occasionally.
Just to make sure I understand, when you say “move” them do you mean running the same code?
That was maybe confusing wording, but when I save the playground to the playground server where is it stored on my computer and can I back it up is what I’m wondering, in case it gets corrupted or lost somehow.
Simplest is to copy code in playground, paste in a text editor and save as a .js flie.
Well that’s what I’m doing now but am thinking it would be more convenient to back them up all at once every once in a while, assuming they’re already stored somewhere, in some file that I can copy and later revert to if needed…
Hmm after investigating more it looks like the playgrounds are always saved to snippet.babylonjs.com even when using a local build. I guess I would have to clone and run a local copy of that too then if it’s a separate repo (I thought I already was, as part of the main repo)… Maybe I’ll just stick with copying and pasting the code then.
You can theoretically run your own snippet server.
The default snippet server URL is snippet.babylonjs.com, but if you run your own local snippet server you can change the URL in
GlobalState.SnippetServerUrl while running the playground locally.
Do you know if the snippet server is open source? I searched on Github a bit but couldn’t find it… Or maybe is closed source for security concerns or something?
I thought about maybe writing a simple express server for just the playgrounds but decided it prob wouldn’t be a good use of my coding time thou…
that’s a good question! It might not be open source. But I have to check.
@Deltakosh - I can’t remember if the snippet server is open? Maybe we should document the interfaces so that people can recreate a simpler implementation of their own?
It is not as we need to address security questions
Documenting the public interface is a good idea!
Ooh that would be super helpful! It’s exactly the part I was worried about getting wrong and spending too much time iterating over…
I assigned myself to keep track of that, we will speak internally who can document the interfaces.
@Blake snippet docs is live now! Make your own Snippet Server | Babylon.js Documentation (babylonjs.com)
Ooh awesome, you even made an example server! Thanks a bunch, will try out soon.