Created
August 20, 2015 07:25
-
-
Save ronfe/b300a369073b96c8f175 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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