aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/src/appCache.js50
-rwxr-xr-xdocs/src/gen-docs.js12
2 files changed, 56 insertions, 6 deletions
diff --git a/docs/src/appCache.js b/docs/src/appCache.js
new file mode 100644
index 00000000..994054c2
--- /dev/null
+++ b/docs/src/appCache.js
@@ -0,0 +1,50 @@
+/**
+* Generate appCache Manifest file here
+*/
+
+exports.appCache = appCache;
+var fs = require('fs');
+
+function appCache(path) {
+ var blackList = [ "offline.html",
+ "sitemap.xml",
+ "robots.txt",
+ "docs-scenario.html",
+ "docs-scenario.js",
+ "app-cache.manifest"
+ ];
+
+ var result = ["CACHE MANIFEST",
+ "# %TIMESTAMP%",
+ "",
+ "# cache all of these",
+ "CACHE:",
+ "../angular.min.js"];
+
+ var resultPostfix = [ "",
+ "FALLBACK:",
+ "/offline.html",
+ "",
+ "# allow access to google analytics and twitter when we are online",
+ "NETWORK:",
+ "*"];
+ walk(path,result,blackList);
+ return result.join('\n').replace(/%TIMESTAMP%/, (new Date()).toISOString()) + '\n' + resultPostfix.join('\n');
+}
+
+function walk(path, array, blackList) {
+ var temp = fs.readdirSync(path);
+ for (var i=0; i< temp.length; i++) {
+ if(blackList.indexOf(temp[i]) < 0) {
+ var currentPath = path + '/' + temp[i];
+ var stat = fs.statSync(currentPath);
+
+ if (stat.isDirectory()) {
+ walk(currentPath, array, blackList);
+ }
+ else {
+ array.push(currentPath.replace('build/docs/',''));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/docs/src/gen-docs.js b/docs/src/gen-docs.js
index dfdbdf45..8ed0c563 100755
--- a/docs/src/gen-docs.js
+++ b/docs/src/gen-docs.js
@@ -4,7 +4,8 @@ var reader = require('reader.js'),
ngdoc = require('ngdoc.js'),
writer = require('writer.js'),
callback = require('callback.js'),
- SiteMap = require('SiteMap.js').SiteMap;
+ SiteMap = require('SiteMap.js').SiteMap,
+ appCache = require('appCache.js');
var docs = [];
var start;
@@ -31,9 +32,9 @@ var writes = callback.chain(function(){
writer.copy('docs/src/templates/index.html', 'build/docs/index-jq.html', writes.waitFor(),
'<-- jquery place holder -->', '<script src=\"jquery.min.js\"><\/script>');
writer.copyTpl('offline.html', writes.waitFor());
- writer.output('app-cache.manifest',
- appCacheTemplate().replace(/%TIMESTAMP%/, (new Date()).toISOString()),
- writes.waitFor());
+ //writer.output('app-cache.manifest',
+ // appCacheTemplate().replace(/%TIMESTAMP%/, (new Date()).toISOString()),
+ // writes.waitFor());
writer.merge(['docs.js',
'doc_widgets.js'],
'docs-combined.js',
@@ -56,6 +57,7 @@ var writes = callback.chain(function(){
'syntaxhighlighter/syntaxhighlighter-combined.css',
writes.waitFor());
writer.copyTpl('jquery.min.js', writes.waitFor());
+ writer.output('app-cache.manifest', appCache('build/docs/'), writes.waitFor());
});
writes.onDone(function(){
console.log('DONE. Generated ' + docs.length + ' pages in ' +
@@ -80,8 +82,6 @@ function appCacheTemplate() {
"docs-keywords.js",
"docs-combined.css",
"syntaxhighlighter/syntaxhighlighter-combined.css",
- "img/texture_1.png",
- "img/yellow_bkgnd.jpg",
"",
"FALLBACK:",
"/ offline.html",