diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-04-30 20:15:08 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-04-30 20:15:08 +0200 |
commit | 36b49c66c6b75515bc84dd678fd52121a313e8d2 (patch) | |
tree | bc7e0f703d4557869943ec7f9495cac7a5027d4f /lib/template/loader.js | |
parent | 87db7cf1d412fa6fbd18e9a7e4f4755f2c0c5547 (diff) | |
parent | 80b8e340dadc54377ff40500f86b1de631395806 (diff) | |
download | gitbook-36b49c66c6b75515bc84dd678fd52121a313e8d2.zip gitbook-36b49c66c6b75515bc84dd678fd52121a313e8d2.tar.gz gitbook-36b49c66c6b75515bc84dd678fd52121a313e8d2.tar.bz2 |
Merge branch 'fixes'
Diffstat (limited to 'lib/template/loader.js')
-rw-r--r-- | lib/template/loader.js | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/lib/template/loader.js b/lib/template/loader.js deleted file mode 100644 index 23d179a..0000000 --- a/lib/template/loader.js +++ /dev/null @@ -1,42 +0,0 @@ -var nunjucks = require('nunjucks'); -var location = require('../utils/location'); - -/* -Simple nunjucks loader which is passing the reponsability to the Output -*/ - -var Loader = nunjucks.Loader.extend({ - async: true, - - init: function(engine, opts) { - this.engine = engine; - this.output = engine.output; - }, - - getSource: function(sourceURL, callback) { - var that = this; - - this.output.onGetTemplate(sourceURL) - .then(function(out) { - // We disable cache since content is modified (shortcuts, ...) - out.noCache = true; - - // Transform template before runnign it - out.source = that.engine.interpolate(out.path, out.source); - - return out; - }) - .nodeify(callback); - }, - - resolve: function(from, to) { - return this.output.onResolveTemplate(from, to); - }, - - // Handle all files as relative, so that nunjucks pass responsability to 'resolve' - isRelative: function(filename) { - return location.isRelative(filename); - } -}); - -module.exports = Loader; |