Skip to content

Instantly share code, notes, and snippets.

@ronfe
Created August 20, 2015 07:25
Show Gist options
  • Save ronfe/b300a369073b96c8f175 to your computer and use it in GitHub Desktop.
Save ronfe/b300a369073b96c8f175 to your computer and use it in GitHub Desktop.
var fs = require('fs');
var jade = require('jade');
var _ = require('lodash');
var async = require('async');
exports.generate = function (arr) {
var fn = jade.compileFile('./template/seed1.jade', {pretty: true});
var chapterFn = jade.compileFile('./template/seed2.jade', {pretty: true});
var topicFn = jade.compileFile('./template/seed3.jade', {pretty: true});
async.parallel([
function(cb){
async.each(arr[0],
function (item, callback) {
fs.writeFile("./out/" + item.activity + '.html', fn(item), callback);
}, function (err) {
console.log("done videos." + (err | ''));
cb(null, 'videos');
}
);
},
function(cb){
async.each(arr[1],
function (item, callback) {
fs.writeFile("./out/root/index.html, fn(item), callback);
}, function (err) {
console.log("done videos." + (err | ''));
cb(null, 'videos');
}
);
}
], function(){});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment