From cd2494eb7c3f61ac93ad0d1bc58ba4f379814fce Mon Sep 17 00:00:00 2001 From: xingzhi Date: Sat, 18 Jul 2015 13:41:29 +0800 Subject: [PATCH] add the option "withExt" for specifying whether the templateName contain the extname of the file name, the default is false --- lib/compile.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/compile.js b/lib/compile.js index f8c3775..7b2327e 100644 --- a/lib/compile.js +++ b/lib/compile.js @@ -60,10 +60,14 @@ module.exports = function(file, options, callback) { options.target= options.target || 'js'; options.htmlmin= options.htmlmin || {}; options.useStrict= options.useStrict || false; + options.withExt = options.withExt || false; function getModule(filepath) { var templateName = path.relative(options.base, filepath); + var ext = path.extname(templateName); + + templateName = options.withExt ? templateName : path.basename(templateName, ext); if (options.target === 'js') { return compileTemplate(options.objName, options.createObj, templateName, file.contents.toString(), options.quoteChar, options.indentString, options.useStrict, options.htmlmin);