asciidoctor / docgist

Render AsciiDoc documents from Gists, GitHub, DropBox and other remote sources in the browser.
http://gist.asciidoctor.org
57 stars 76 forks source link

Use HTML5 Appcache #12

Closed nawroth closed 9 years ago

nawroth commented 10 years ago

See for example: http://appcachefacts.info/peterlubbers-owc4/index.html

The best part of using Appcache is -- IMHO -- that either all resource files are refreshed or none. I've noticed a few times when pushing to gh-pages, that for example loading DocGist or GraphGist will end up with a mix of old and new files. Which usually means some things are broken.

The bad part is that the manifest has to be maintained somhow (or generated, I hope). Also, changes to the resource files won't be picked up (ever!) unless the manifest gets changed (it might just be a change in a comment).

mojavelinux commented 10 years ago

I think this is definitely a step in the right direction. The cache GitHub Pages is the one thorn of hosting sites with GitHub.

Another option is to add a ?t= query string to the URL. That busts the cache as well.

Keep in mind if we decide this becomes too much of an issue, we could always consider deploying to OpenShift or Heroku.

nawroth commented 9 years ago

It seems AppCache isn't the way to go any more: https://www.fxsitecompat.com/en-US/docs/2015/application-cache-api-has-been-deprecated/

While looking into this, I also found out that the dynamic loading of syntax highlighters breaks in Firefox, so I'm adding all of them to index.html instead.

nawroth commented 9 years ago

Too early to move on to the Service Worker solution, let's close this for now. http://caniuse.com/#feat=serviceworkers

mojavelinux commented 8 years ago

@hsablonniere has a really nice coverage of Service Workers (and the deprecation of AppCache) in his talk from Devoxx BE 2015. See https://www.youtube.com/watch?v=SltjVpgTaCo

hsablonniere commented 8 years ago

Hi.

I would not say too early. Service Worker embrace progressive enhancement so browser without support will work just fine like before.

What's the use case? Would you want the user to select what's cached? Would you want to try something like last 10 gist avaiblable etc... ?

I would be interested to implement something but we need to discuss a user scenario. And we need a SSL cert (https://letsencrypt.org/ opens its beta on december 3).

nawroth commented 8 years ago

@hsablonniere The main use case is to make the pages load super fast. I think it's a very good fit for how AppCache works:

Next up would be to add a 3.6MB library (https://github.com/mdaines/viz.js/) without affecting the user experience too much.

Storing the last gists visited would be cool!

mojavelinux commented 8 years ago

I think it's a very good fit for how AppCache works:

I think this is exactly the use case that @hsablonniere proposes is better done with service workers in his talk. AppCache looks seductive on the surface, but in the end it's a douchebag.

Next up would be to add a 3.6MB library (https://github.com/mdaines/viz.js/) without affecting the user experience too much.

Absolutely. We can leverage the tools of the browser to make this all more seamless and speedy. It just seems to me that service workers are a better fit (or @hsablonniere is just very persuasive).

nawroth commented 8 years ago

AppCache is a tricky beast, yes. And as it's on its way out, service workers are no doubt the way to go now.