Add global method resolve(fileName)

This commit is contained in:
Johan Preynat
2016-05-04 10:25:37 +02:00
parent c84eaa83dd
commit da8611e0c3
+11
View File
@@ -1,3 +1,4 @@
var path = require('path');
var Promise = require('../utils/promise');
var PathUtils = require('../utils/path');
var fs = require('../utils/fs');
@@ -67,6 +68,16 @@ function encodeGlobal(output) {
return bookFS.readAsString(fileName);
},
/**
Resolve a file from the book root
@param {String} fileName
@return {String}
*/
resolve: function(fileName) {
return path.resolve(book.getContentRoot(), fileName);
},
template: {
/**
Apply a templating block and returns its result