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

你。 提交于 2019-12-19 08:53:02

问题


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


回答1:


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.




回答2:


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

meteor add appcache

https://atmospherejs.com/meteor/appcache



来源:https://stackoverflow.com/questions/10668687/how-can-i-add-a-cache-manifest-to-a-meteor-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!