Created
July 23, 2016 07:43
-
-
Save simonmcmanus/079f61c0e51fff4f38329df0c7511956 to your computer and use it in GitHub Desktop.
app manifest with components and pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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