Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing snippets #2

Open
bfricka opened this issue Jan 7, 2013 · 11 comments
Open

Sharing snippets #2

bfricka opened this issue Jan 7, 2013 · 11 comments

Comments

@bfricka
Copy link
Owner

bfricka commented Jan 7, 2013

Discuss either serializing to query string or simple backend system.

@scottrippey
Copy link
Collaborator

My impression is that this tool is mostly useful for:

  • Demoing or testing a specific feature of LESS
  • Comparing the specific differences between versions of LESS

In both cases, I'd say that the input will be very short. So, I think query string would probably be fine. Perhaps a "tinyUrl" integrated button for url-shortening? (so you can share the link without spamming!)

@scottrippey
Copy link
Collaborator

Update:
Ok, so maybe I didn't realize your enthusiasm with this project! A TLD? Very cool. And the rest of the changes, I'll compliment you in person for those!
Considering your grandiose vision for this project, I think the sharing feature might be much more useful than query string serialization.

So, I think it would be wonderful to see:

  • Saving/sharing would generate a unique id, such as JSFiddle / Codepen / etc. (eg. case-sensitive alpha-numeric 5 digits)

If the page is still hosted via GitHub, there would probably be an A-name record for the server side component, server.less2css.org ? The unique id could be added as a hash or query string, but not a path.

@bfricka
Copy link
Owner Author

bfricka commented Jan 9, 2013

Yeah, I'm not sure what I ultimately want this to be. I think first it makes sense to implement the easy stuff that doesn't require server side. If I get a hankering for more, I can host it on my VPS.

My dilemma then would be: Rails or Node.js. If you're going to contribute then, Node probably makes sense since there won't be much learning curve. Otherwise, I'll likely use Rails, since there is less headache. Let me know

@scottrippey
Copy link
Collaborator

Agreed, a simple solution would be best to do first, and the query string would be easiest.

But here's another thing, I've been in touch with the Less developers, and they recommended to add "try it now" links to lesscss.org (on Github) that link to this live editor!
So keeping that in mind, I think it would be great to easily generate "deep links" that include all text as the query string. No url shortening needed.

brian-frichette [email protected] wrote:

Yeah, I'm not sure what I ultimately want this to be. I think first it makes sense to implement the easy stuff that doesn't require server side. If I get a hankering for more, I can host it on my VPS.

My dilemma then would be: Rails or Node.js. If you're going to contribute then, Node probably makes sense since there won't be much learning curve. Otherwise, I'll likely use Rails, since there is less headache. Let me know


Reply to this email directly or view it on GitHub.

@lukeapage
Copy link

the url string could get pretty big.. and isn't there a 2048 limit?

in the same way as

https://lea.verou.me/2011/12/introducing-dabblet-an-interactive-css-playground/

couldn't it save to github gists ? then it wouldn't need anything serverside?

@gustavohenke
Copy link

The 2048 limit, the far I know, is for ooold browsers & servers, @agatronic ;D
I would go with generating an random string and using it as file names @ the server side. Or a simple 3-column table:

  • Random string
  • File contents
  • Version

@scottrippey
Copy link
Collaborator

I think involving a server-side component is a good idea, because it alleviates any size limits (I know for sure that IE has lower limits than others), and allows easier link sharing.

However, supporting a querystring is still a solid idea, because for short snippets, you could update the link without having to make a new version.

Use-case? On lesscss.org, there are tons of less samples. It would be great if each sample was accompanied by a "Try It" button. So, when someone updates the less sample, they could easily update the "Try It" button's querystring (without having to create a new version).
In fact, to keep DRY, you could actually wrap the sample and button as follows: (this is just an example, you'd have to somehow get this to work with the syntax-highlighting).

<form method="get" action="https://www.less2css.org/"> <textarea name="lessInput"> (less sample) </textarea> <input type="submit" value="Try It" /> </form>

@scottrippey
Copy link
Collaborator

@gustavohenke The server-side component obviously requires a lot more than a gh-pages site allows, so that's probably the biggest current limitation. However, @brian-frichette was planning on using his own hosting for the server component, unless an alternative can be found ...

... which leads me to @agatronic's statement ... are you suggesting that GitHub has an API that could accommodate this server-side component, by allowing snippets to be loaded & saved using Gists? That would be a perfect solution, because you could share the Gist, report issues against a specific Gist, etc. Sounds pretty cool, if I interpreted your comment correctly!

@lukeapage
Copy link

@scottrippey sorry I wasn't clear.. yes, gists can be created from an api on the client (e.g. in the browser). Dabblet does this. Here is what a quick search led me too, to find it

https://github.com/LeaVerou/dabblet/blob/master/code/global.js

If it could support gists and URL's, that would be the ultimate - As a user I'd rather use gists, and in the lesscss site It would be cool to generate them as URL's.

@bfricka
Copy link
Owner Author

bfricka commented Jan 13, 2013

I have no problem creating a "Create Gist" button for the current chunk of code. However, I have moved this to Express, as I want the power and flexibility that server-side has to offer, and it's really the best way to do short URLs.

I think it makes more sense for the sharing component to link to this site with the correct code saved, rather than to reference a gist. This was one of the main things we originally wanted to do: Be able to share something like CodePen / jsbin, but with much better support for LESS.

Basically, I don't want to tangle gists and code-sharing. Most people use gists for what I use them for: storing snippets of re-usable code. I realize they can be used for more, but they aren't the ideal solution in this case.

It's a cool idea though, and I appreciate the feedback.

@lukeapage
Copy link

@brian-frichette Thanks - any sharing will be good, mainly thought gists were a good idea to save you work/need for a serverside component.. Think your solution will be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants