ashes999 / butterfly

Haxe generator for simple, static blogs.
28 stars 1 forks source link

Browser assets cache reset #11

Open fullofcaffeine opened 6 years ago

fullofcaffeine commented 6 years ago

Hi,

I'm experimenting with butterfly and I'm wondering how you'd deal with cleaning the browser cache when you push a new version to be served by the web server. I know there are headers that you can use and meta tags, and there's also the option of adding a unique hash to as a suffix to the assets files (middleman and jekyll have this out-of-the-box).

How do you deal with this currently for your butterfly-genereted sites?

ashes999 commented 6 years ago

Hi,

To be honest, I've never thought about or dealt with the issue. Refreshing a few times (or CTRL+SHIFT+R in Chrome) cleans the cache and shows me the updates.

Obviously, you can't tell this to consumers of your site. Unless you're publishing multiple new posts a day, I don't think this will really affect them.

One option I've seen used in the past is to append a random query string parameter to each request, eg. ?r=123281 which is generated automatically on the server-side. I don't know if that's an option worth investigating.

Headers and meta-tags might be the path of least resistance. I don't use Butterfly any more, but feel free to fork it and/or open a PR if that fits your needs.

fullofcaffeine commented 6 years ago

Thanks for the insights. I'll probably implement some kind of asset hash.

I don't use Butterfly any more, but feel free to fork it and/or open a PR if that fits your needs. Oh, are you using something else for your static sites/blogs?

Cheers!

ashes999 commented 6 years ago

Oh, are you using something else for your static sites/blogs?

No, I simply haven't felt a need to blog in a long time. And my main site uses something custom (not Butterfly), because it has different requirements.

fullofcaffeine commented 6 years ago

Oh ok.

There's some appeal to using a site generator and Haxe is a nice option because some targets are much faster than Ruby. Ruby does have excelent generators like Jekyll and Middleman but it eventually becomes slow as hell for bigger sites.

I think that for technical people, site generators are better than resident apps (like Wordpress) because we're used to formats like Markdown and the overhead of serving static files is much lower than hosting the actual app in memory with caching etc. That's why I think Butterfly has some potential :)

On Mon, Jan 29, 2018 at 3:55 PM, ashes999 notifications@github.com wrote:

Oh, are you using something else for your static sites/blogs?

No, I simply haven't felt a need to blog in a long time. And my main site uses something custom (not Butterfly), because it has different requirements.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ashes999/butterfly/issues/11#issuecomment-361400004, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE9YL50HO2rK4pg_IjQbeDHyL8ThzE6ks5tPj5HgaJpZM4RxRiE .