Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Added a method to set/get a Handlebars instance #6

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var gutil = require('gulp-util');
var through = require('through2');
var Handlebars = require('handlebars');
var Promise = require('bluebird');
var _ = require('lodash');
var Path = require('path');
var writable = require('./lib/writable');
var Handlebars = null;

/**
* Duck-typing to allow different promise implementations to work.
Expand Down Expand Up @@ -59,7 +59,7 @@ function getPromises(obj, fn) {
} else if (isPromise(obj)) {
obj.then(function (result) {
getPromises(result, fn);
})
});
}
return [];
}
Expand All @@ -68,8 +68,8 @@ module.exports = function (data, options) {
var dataDependencies;
options = options || {};
var dependencies = [];
Handlebars = Handlebars || require('handlebars');
//Go through a partials object

if (data) {
if (isPromise(data)) {
dataDependencies = data.then(function (result) {
Expand Down Expand Up @@ -126,4 +126,12 @@ module.exports = function (data, options) {
});
};

module.exports.Handlebars = Handlebars;

module.exports.using = function () {
Handlebars = Handlebars || require('handlebars');
return Handlebars;
};

module.exports.use = function (customHandlebars) {
Handlebars = customHandlebars;
};