diff --git a/index.js b/index.js index 2a7b1ce..80fa988 100644 --- a/index.js +++ b/index.js @@ -4,8 +4,12 @@ var Promise = require('bluebird'); var fs = Promise.promisifyAll(require('fs-extra')); var path = require('path'); -var getTemplate = function () { - return fs.readFileAsync(path.join(__dirname, 'template', 'less.hbs'), 'utf8'); +var getTemplate = function (opt) { + if(opt.template){ + return fs.readFileAsync(path.join(process.cwd(), opt.template), 'utf8'); + }else{ + return fs.readFileAsync(path.join(__dirname, 'template', 'less.hbs'), 'utf8'); + } }; var transform = Promise.method(function (layouts, source, opt, Handlebars) { @@ -18,7 +22,7 @@ var transform = Promise.method(function (layouts, source, opt, Handlebars) { module.exports = { process: function (layouts, opt, Handlebars) { - return getTemplate() + return getTemplate(opt) .then(function (source) { return transform(layouts, source, opt, Handlebars); });