Open Miserlou opened 10 years ago
rawgithub mentions we could use http://pages.github.com/
Or how about making it a browser extension!
Pages is probably a good idea.
So is browser extension, but maybe open another ticket about that. I'd like that because then you could launch it with just a key command.
The browser extension also means the files would be stored locally and loaded instantly.
On Mon, Mar 3, 2014 at 3:18 AM, Rich Jones notifications@github.com wrote:
Pages is probably a good idea.
So is browser extension, but maybe open another ticket about that. I'd like that because then you could launch it with just a key command.
Reply to this email directly or view it on GitHubhttps://github.com/Miserlou/OpenSpritz/issues/13#issuecomment-36489113 .
But a browser extension would mean we'd lost the ability for it to work on iOS.
On 3 Mar 2014, at 08:20, Nick R notifications@github.com wrote:
The browser extension also means the files would be stored locally and loaded instantly.
On Mon, Mar 3, 2014 at 3:18 AM, Rich Jones notifications@github.com wrote:
Pages is probably a good idea.
So is browser extension, but maybe open another ticket about that. I'd like that because then you could launch it with just a key command.
Reply to this email directly or view it on GitHub< https://github.com/Miserlou/OpenSpritz/issues/13#issuecomment-36489113> .
Reply to this email directly or view it on GitHubhttps://github.com/Miserlou/OpenSpritz/issues/13#issuecomment-36489219 .
Good point.
On Mon, Mar 3, 2014 at 3:21 AM, universemaster notifications@github.comwrote:
But a browser extension would mean we'd lost the ability for it to work on iOS.
On 3 Mar 2014, at 08:20, Nick R notifications@github.com wrote:
The browser extension also means the files would be stored locally and loaded instantly.
On Mon, Mar 3, 2014 at 3:18 AM, Rich Jones notifications@github.com wrote:
Pages is probably a good idea.
So is browser extension, but maybe open another ticket about that. I'd like that because then you could launch it with just a key command.
Reply to this email directly or view it on GitHub< https://github.com/Miserlou/OpenSpritz/issues/13#issuecomment-36489113> .
Reply to this email directly or view it on GitHub< https://github.com/Miserlou/OpenSpritz/issues/13#issuecomment-36489219>
.
Reply to this email directly or view it on GitHubhttps://github.com/Miserlou/OpenSpritz/issues/13#issuecomment-36489316 .
GitHub Pages should work, it was originally confirmed to be OK to use as CDN so serving up a single bookmarklet JS file should be no problem. (source)
Okay, so GitHub pages works for the JavaScript, but not for the .html which spritz.js calls.
Bummer! Any ideas?
Any ideas?
https://github.com/jsdelivr/jsdelivr CDN Like CDNJS, but it is like 3 CDNs multiplexed into 1 (2 big ones, several minor ones). You can also use version aliasing so minor SemVer changes can still use the same bookmarks.
rawgithub.com is cool for jsPerf, CodePen, & alpha test versions. Not so sure if he would be crazy about continuous 10s of thousands of serves per day.
Bummer! Any ideas?
Merge the HTML into the JS? What is the reason for keeping them separated?
What is the reason for keeping them separated?
You can't run a HTML bookmarklet ;) But the JS could be small to just be inserting the HTML into the DOM, if XSS allows HTML JS to be ran. Though you are onto something; the CSS could be inserted into the HTML That would cut the rawgithub.com requests significantly.
@tomByrer, sorry, but I don’t think I know what you mean by “a HTML bookmarklet”.
Currently the bookmarklet simply loads the spritz.js
from GitHub Pages. And then spritz.js
loads spritz.html
via rawgithub.com. Right? So why not take the content of spritz.html
and pack it inside spritz.js
as a string? Then there is no need for this extra file fetching and everything can be served as a single JavaScript file through GitHub Pages.
So that’s where my question was coming from: why does it need a separate HTML file and can’t the HTML be embedded inside the JavaScript file?
Yes, the bookmarklet needs to be JS. I've inserted other JS via bookmarket, but never ran JS inside an inserted HTML. Have you done this?
We could totally put the HTML and CSS as a string inside of the javascript, the downside is that it just more difficult to maintain and introduce typos. But it would also speed things up as we wouldn't be making multiple requests. It kind of depends on what the purpose is of this. Is the end goal to be a bookmarklet, a browser extension, or just a library for splitting and displaying words that something else embeds?
This is a bookmarklet. If somebody wants to create a browser extension, that should be maintained as a separate project as I don't have the resources to maintain both in the same project - I'm barely keeping up with the pull requests as it is! (Also, I'm a Firefox user. Moz4lyfe.)
I vastly value code readability and maintainability more than efficiency (a single request is no big whoop) - and a having to maintain a huge string of HTML is a huge pain in the ass.
Maintainability is a great point; perhaps a package manager that compiles all the JS, HTML, CSS into a single JS file would be best? Then you just develop separate files, & let the compiler script combine & minify.
That's probably the right way to do it, have a -release and a -dev channel.
It is common for GitHub repos use a "build script" to collate, code check, test, minify, etc before "publishing" the final version(s) into another folder. Package manager tools can sometimes act as this build script.
Also, using a package manager should fix the Not using the global namespace issue.
I can throw it up on jsDelivr if you want once you get more stable & minified; should improve loading speed also. rawgithub.com is great for the dev-branch (that's why it's there), but not so hot for popular live code that has 1030+ stars :)
I'd like to see some optimizations be tested & minification landed before going on the CDN please.
I've suggested jsDelivr before, but they need minified files, & that has not been engineered yet. On Mar 19, 2014 12:27 PM, "Bernhard Millauer" notifications@github.com wrote:
What about using jsDelivr?
https://hacks.mozilla.org/2014/03/jsdelivr-the-advanced-open-source-public-cdn/
Reply to this email directly or view it on GitHubhttps://github.com/Miserlou/OpenSpritz/issues/13#issuecomment-38088733 .
OpenSpritz currently serves with RawGithub - which is a terrible idea and won't scale.
We need a better solution which allows us to either stable releases, or a way to have rolling releases that track the GitHub head but don't rely on a cache service which threatens to replace our script with evil.js.