From 2354a513c0fae22913807aeb3a6c66a0a8e989fa Mon Sep 17 00:00:00 2001 From: David Gageot Date: Mon, 5 Jan 2015 15:07:40 +0100 Subject: [PATCH] Support literate coffeescript --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a00d88b..9fa53f1 100644 --- a/index.js +++ b/index.js @@ -11,7 +11,7 @@ var createCoffeePreprocessor = function(args, config, logger, helper) { var options = helper.merge(defaultOptions, args.options || {}, config.options || {}); var transformPath = args.transformPath || config.transformPath || function(filepath) { - return filepath.replace(/\.coffee$/, '.js'); + return filepath.replace(/\.coffee$/, '.js').replace(/\.litcoffee$/, '.js'); }; return function(content, file, done) { @@ -25,6 +25,9 @@ var createCoffeePreprocessor = function(args, config, logger, helper) { // Clone the options because coffee.compile mutates them var opts = helper._.clone(options) + // Set literate option based on file extension + opts.literate = /\.litcoffee$/.test(file.originalPath); + try { result = coffee.compile(content, opts); } catch (e) {