Skip to content

Commit da8611e

Browse files
committed
Add global method resolve(fileName)
1 parent c84eaa8 commit da8611e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/api/encodeGlobal.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var path = require('path');
12
var Promise = require('../utils/promise');
23
var PathUtils = require('../utils/path');
34
var fs = require('../utils/fs');
@@ -67,6 +68,16 @@ function encodeGlobal(output) {
6768
return bookFS.readAsString(fileName);
6869
},
6970

71+
/**
72+
Resolve a file from the book root
73+
74+
@param {String} fileName
75+
@return {String}
76+
*/
77+
resolve: function(fileName) {
78+
return path.resolve(book.getContentRoot(), fileName);
79+
},
80+
7081
template: {
7182
/**
7283
Apply a templating block and returns its result

0 commit comments

Comments
 (0)