bfricka / less-preview

Browser-based LESS to CSS converter built on Express
http://less2css.org
82 stars 41 forks source link

Sharing snippets #2

Open bfricka opened 11 years ago

bfricka commented 11 years ago

Discuss either serializing to query string or simple backend system.

scottrippey commented 11 years ago

My impression is that this tool is mostly useful for:

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 commented 11 years ago

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:

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 commented 11 years ago

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 commented 11 years ago

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 notifications@github.com 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 commented 11 years ago

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

in the same way as

http://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 commented 11 years ago

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:

scottrippey commented 11 years ago

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="http://www.less2css.org/"> <textarea name="lessInput"> (less sample) </textarea> <input type="submit" value="Try It" /> </form>
scottrippey commented 11 years ago

@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 commented 11 years ago

@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 commented 11 years ago

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 commented 11 years ago

@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.