Closed bfricka closed 11 years ago
That's a great idea. I was trying to figure out how input could be stored ... but what about sharing? What if we serialized the input into the query string? That's the only way I can think of sharing without a server-side component.
brian-frichette notifications@github.com wrote:
I'd like to add caching for the LESS input so values are retained.
— Reply to this email directly or view it on GitHub.

Using the URL to store the data will work for smaller examples, and perhaps that is good enough for most cases for which this would be used. I'm for it. However, max length of a URL is 2k characters or less in most browsers, so we'll have to keep that in mind.
I'm not against creating a simple server side component using Node and MongoDB if we need storage in the future. I have a VPS I can host it on.
In the meantime, I'll work on the localStorage, and the query string as well if I have the time.
BTW, one thing I thought of: If we use the query string, we'll probably want to strip whitespace. However, I believe the CodeMirror editor may have methods or plugins that will restore white-space. If not, we'll have to create one.
Just as an example, the default lessInput when URI-encoded, is already 703 characters. With whitespace stripped and URI-encoded, it's 457.
Thus we could get decent snippets under 2k characters, more so if we strip and restore whitespace.
Stripping the whitespace and restoring it sounds like the best bet! I'd be curious to see a simple backend implementation ... using jsonp I'd assume?
brian-frichette notifications@github.com wrote:
BTW, one thing I thought of: If we use the query string, we'll probably want to strip whitespace. However, I believe the CodeMirror editor may have methods or plugins that will restore white-space. If not, we'll have to create one.
Just as an example, the default lessInput when URI-encoded, is already 703 characters. With whitespace stripped and URI-encoded, it's 457.
Thus we could get decent snippets under 2k characters, more so if we strip and restore whitespace.
— Reply to this email directly or view it on GitHub.

I implemented localStorage caching. Going to close this and open a separate issue for queryString / sharing discussion.
I'd like to add caching for the LESS input so values are retained.