Mattias Petter Johansson
Mattias Petter Johansson

Reputation: 1074

How can I add a cache manifest to a Meteor app?

Well, adding it will be no problem, but how can I generate the cache manifest? I would need to somehow get the paths to the combined CSS and JS that Meteor generates. http://www.whatwg.org/specs/web-apps/current-work/#manifests

Upvotes: 4

Views: 1466

Answers (2)

jonathanKingston
jonathanKingston

Reputation: 1418

Update:

As user1506145 said:

meteor add appcache

https://atmospherejs.com/meteor/appcache

This answer is out of date:

The answer lies in the bundler package, I autogenerated a manifest file there. You can get a full list of css and js files by hooking into: bundle.css and bundle.js.client

Once you have managed to get them a manifest file you will need to do the following with a manifestcontent var you have generated (dont forget to exclude from caching all the meteor urls needed):

buffer.files.client_cacheable['manifest.appcache'] = new Buffer(manifestcontent);

This will have your application serving the appcache file. Then you can edit /app/lib/app.html.in to add the reference in.

My issue when I did this was that I wasn't able to stale the cache often enough so it ended up with an application messed up on reload from the server.

Upvotes: 4

user1506145
user1506145

Reputation: 5286

You may automatically generate and include the manifest by adding the appcache package.

meteor add appcache

https://atmospherejs.com/meteor/appcache

Upvotes: 2

Related Questions