Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support literate coffeescript #26

Closed
wants to merge 1 commit 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
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down