Skip to content

Instantly share code, notes, and snippets.

@recidive
Created January 31, 2014 20:10
Show Gist options
  • Select an option

  • Save recidive/8742027 to your computer and use it in GitHub Desktop.

Select an option

Save recidive/8742027 to your computer and use it in GitHub Desktop.
Generate JSON files for pages in page() hook.
var objectType = 'page';
for (var i in newPages) {
var newObject = newPages[i];
if (!newObject.callback) {
require('fs').writeFileSync(require('path').join(__dirname, '/' + i + '.' + objectType + '.json'), JSON.stringify(newObject, null, ' '), {flag: 'w'});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment