Skip to content

Commit

Permalink
Pre-compile jade file in watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
janmeier committed Jun 30, 2016
1 parent 4654325 commit c124dbc
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions bin/watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,21 @@ if (dbEntry.error) {
return;
}

var template = jade.compileFile('./views/api.jade');

app.get('/', function (req, res) {
res.send(jade.renderFile('./views/api.jade', _.extend({
doclet: new Doclet({
data: {
hot: true,
doclets: gather.createDoclets(dbEntry.config, repoPath),
articles: dbEntry.articles
}
}),
moment: require('moment'),
_: _
}, dbEntry, structure, viewParams)));
doclet = new Doclet({
data: {
hot: true,
doclets: gather.createDoclets(dbEntry.config, repoPath),
articles: dbEntry.articles
}
});


res.send(template(_.extend({
moment: require('moment')
}, viewParams.getApiParams(doclet), dbEntry, structure, viewParams)));
});

app.use(express.static('assets'));
Expand Down

0 comments on commit c124dbc

Please sign in to comment.