Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save simonmcmanus/079f61c0e51fff4f38329df0c7511956 to your computer and use it in GitHub Desktop.
Save simonmcmanus/079f61c0e51fff4f38329df0c7511956 to your computer and use it in GitHub Desktop.
app manifest with components and pages
'use strict'
/**
* Generates an app cache file based on the spec provided.
*/
var fs = require('fs')
var files = [
'CACHE MANIFEST'
]
module.exports = function (spec, customFiles, callback) {
Object.keys(spec).forEach(function (page) {
var pageName = spec[page].page;
var pathPath = '/pages/' + pageName + '/' + pageName + '.html'
console.log(spec[page])
files.push(pathPath)
//files.push(page)
for (var selector in spec[page].spec) {
var component = spec[page].spec[selector].component;
files.push('/components/' + component + '/' + component + '.html');
}
})
files = files.concat(customFiles)
files.push('# v-' + +new Date())
files.push('NETWORK:', '*')
fs.writeFile(process.cwd() + '/manifest.appcache', files.join('\n'))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment