Permalink
Browse files

support layout

  • Loading branch information...
1 parent 078d19a commit c3bb15b23e74dc78e98d921d9d53d3c52324b72a @joeferner joeferner committed May 17, 2012
Showing with 8 additions and 1 deletion.
  1. +4 −1 lib/format/html/index.js
  2. +4 −0 lib/format/html/layout.ejs
View
@@ -75,9 +75,12 @@ function sortFiles(filesToSort) {
function render(filePath, templatePath, viewData, callback) {
mkdirp.sync(path.dirname(filePath));
+ var layoutPath = path.join(__dirname, 'layout.ejs');
+ var layout = fs.readFileSync(layoutPath, 'utf8');
var template = fs.readFileSync(templatePath, 'utf8');
viewData.renderPieChart = renderPieChart;
- var html = ejs.render(template, viewData);
+ viewData.body = ejs.render(template, viewData);
+ var html = ejs.render(layout, viewData);
fs.writeFile(filePath, html, callback);
}
@@ -0,0 +1,4 @@
+<!doctype html>
+<html lang="en">
+ <%- body %>
+</html>

0 comments on commit c3bb15b

Please sign in to comment.