osquery-1/site/build.js

19 lines
557 B
JavaScript
Raw Normal View History

2014-10-05 11:50:40 +00:00
var fs = require('fs');
var path = require('path');
var nodejsx = require('node-jsx').install();
var Root = require('./src/Root');
Root.getPages()
.forEach(function (fileName) {
var RootHTML = Root.renderToString({initialPath: fileName});
var target = path.join(__dirname, fileName);
var dirname = target.replace(/\\/g, '/').replace(/\/[^\/]*\/?$/, '');
fs.exists(target, function(exists) {
if (!exists) {
fs.mkdirSync(dirname, 0755);
}
fs.writeFileSync(path.join(__dirname, fileName), RootHTML);
});
});