Clouda Manifest介紹
Clouda框架會(huì)將各個(gè)package.js中描述的JS和CSS資源自動(dòng)寫入manifest文件形成離線緩存。 如果對(duì)于圖片,音樂等其他文件也有離線緩存需求,可通過建立app.manifest文件進(jìn)行描述。 在app.manifest中描述過的資源,Clouda框架在啟動(dòng)時(shí)會(huì)一并寫入整體manifest文件中。
app.manifest文件應(yīng)該建立在如下位置,與controller,publish等目錄平級(jí):
app/app.manifest
app.manifest文件的格式與w3c規(guī)定的manifest文件格式一致,見:http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html
注意:目前暫不支持SETTINGS:域
一個(gè)示例:
- CACHE MANIFEST
- # the above line is required
- # this is a comment
- # there can be as many of these anywhere in the file
- # they are all ignored
- # comments can have spaces before them
- # but must be alone on the line
- # blank lines are ignored too
- # these are files that need to be cached they can either be listed
- # first, or a "CACHE:" header could be put before them, as is done
- # lower down.
- images/sound-icon.png
- images/background.png
- # note that each file has to be put on its own line
- # here is a file for the online whitelist -- it isn't cached, and
- # references to this file will bypass the cache, always hitting the
- # network (or trying to, if the user is offline).
- NETWORK:
- comm.cgi
- # here is another set of files to cache, this time just the CSS file.
- CACHE:
- style/default.css