Closed isaacharrisholt closed 1 month ago
For sharing the query string length is very precious and thus I would not do that. I would include a g=1 in the QS maybe so if gleam 2 happens the playground is usable for both.
Also escaping gleam code into json adds a lot of string length.
for a download/upload feature + multi module tabs the json structure looks great <3, I'd still include a gleam version and I am uncertain about deps.
The QS len is so precious because people might start sharing code snipplets on discord and we would want to limit the length of that strictly I suppose?
Oh it would definitely need compressing. One sec, let me make sure to add that to the description
The old playground has some query string compatible compression feature that can be just copied over I guess.
However, that only helps "so much"
Agreed, but it means we don't need a database etc. We could definitely go the GitHub gist route, like the Rust playground, but that would require a backend with GitHub access. This way we can keep using a static site. Open to other ideas though!
It needs to go in the hash/fragment, not the query string. There are very tight restrictions on query string length which mean it is not usable for this, but there are no such restrictions on the hash/fragment.
Formatting and examples are not a goals of this first version, and I think we can skip the about page too. Less is more and shipping faster is best.
btw you've committed the public directory by mistake. Could you remove those files from the git history please before merging 🙏
Ah, thanks for the advice! Very helpful.
Also, history should now be public
-free!
@lpil should be all good to go. I've left out Erlang compilation for now, as it would require also including the Erlang stdlib, and that's a larger piece of work. I'll create issues for the missing features.
@lpil all sorted, I believe!
Ah, gotcha! Yes, I can do that.
I think it's still worth having a page_template()
or similar function, though. We may want to add an about page or similar later, no? Or can we guarantee this project will always be a single page?
Hey I've been playing around and I'm not entirely sure how you want this to look. I think ultimately we need to keep a lot of the PageConfig
, HeadConfig
etc. otherwise we'll just end up with some massive function defining all the HTML for the page, and I don't think it'll be readable.
I remove the get_pages
function and change it to need a single write
call for each page like you suggested, but I'm not sure what that really achieves? All get_pages
does really is define the output settings for multiple pages. If we changed it, we'd just be spreading this config throughout multiple functions.
I've been playing around with it and there is an issue with the share link generation, it doesn't url encode the title, so if there are spaces in it (like there is in the default "A Gleam Playground project", then the link won't work
static/index.js, line 202: you need to wrap the title in encodeURIComponent(originalString);
I've been playing around with it and there is an issue with the share link generation, it doesn't url encode the title, so if there are spaces in it (like there is in the default "A Gleam Playground project", then the link won't work
static/index.js, line 202: you need to wrap the title in encodeURIComponent(originalString);
Fixed, thank you! I managed to overlook that because you can paste spaces into Chrome, but totally forgot that these links are made for sharing and wouldn't be clickable 😅
I have it up on gleam-playground.fly.dev for testing
I have it up on gleam-playground.fly.dev for testing
Thanks for that! Is it the latest version? It doesn't seem to have the encoded URI component.
no it wasn't... just pulled your change and re-deployed it.,
See gleam-lang/playground#6
TODO:
Format buttonExample projects"About the playground" page design and contentDiscussion
Share button
For the share button, I was thinking of potentially encoding something like the following as JSON:
This would need compressing to keep query string length down.
This will allow us to expand the playground later to include multi-file projects so people can experiment with project structure and so on, and keeping it versioned will help maintain backwards compatibility if this changes in the future.
Example projects
It would be good to have some short example Gleam projects, like the Go playground has, to show off the sort of stuff you can accomplish with Gleam. Let me know if you have any ideas!