fix: crash when express views set to string

This commit is contained in:
harttle
2016-11-06 16:22:52 +08:00
parent e9ff3d916d
commit a82e50e1ab
5 changed files with 66 additions and 67 deletions
-19
View File
@@ -1,19 +0,0 @@
const Liquid = require('..');
module.exports = function() {
var engine = Liquid({
root: '/root/',
extname: '.html'
});
function express(filePath, options, callback) {
fs.readFile(filePath, function(err, content) {
if (err) return callback(new Error(err));
// this is an extremely simple template engine
var rendered = content.toString().replace('#title#', '<title>' + options.title + '</title>')
.replace('#message#', '<h1>' + options.message + '</h1>');
return callback(null, rendered);
});
}
return express;
};