We have a site that builds locally with Jekyll and Jekyll-Assets (which uses sprockets).
We'd like to be able to generate a cache manifest that has all the files that go into the resultant site. We'd like to generate this as a part of the build process so that the entire site will be available offline. (It's a very small site, but we're opposed to manual work!)
The images and the css have a hash appended to the filename during the build so we can't predict the outcome.
We've tried using the {% asset_path logo.png %}
etc. method, but it doesn't get processed. I.e. it leaves the Liquid tag as is in the final file. ERB does work (<%= 2+3 %>
gives 5) but we can't see a way of accessing the resultant files.
We are considering another task runner to wrap the whole thing, but this feels like overkill.
jekyll-perf
builds a manifest.appcache
file. The project appears as if it might be dormant, but they were doing it as follows. Hopefully this is useful as a starting point. You may need to adjust things for your asset paths etc., naturally.
(I'm not sure if the for
stuff in this will take care of your appended hash issue or not. Apologies if this is exactly what you've already tried and it hasn't worked for you.)
---
---
CACHE MANIFEST
# rev {{ site.buildtime }}
CACHE:
{% asset_path all.css %}
{% for page in site.pages %}{% if page.url != '/manifest.appcache' %}{{ page.url }}{% endif %}
{% endfor %}
{% for item in site.images %}{{ item.url }}
{% endfor %}
{% for item in site.scripts %}{{ item.url }}
{% endfor %}
NETWORK:
*
http://*
https://*
Don't forget :
The empty front matter in your manifest
---
# empty front matter
---
[...]
To loop over your collections if your outputting them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With