You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

48 lines
1.8 KiB

// Generated by CoffeeScript 1.6.2
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
module.exports = function(BasePlugin) {
var CoffeescriptPlugin, _ref;
return CoffeescriptPlugin = (function(_super) {
__extends(CoffeescriptPlugin, _super);
function CoffeescriptPlugin() {
_ref = CoffeescriptPlugin.__super__.constructor.apply(this, arguments);
return _ref;
}
CoffeescriptPlugin.prototype.name = 'coffeescript';
CoffeescriptPlugin.prototype.config = {
compileOptions: {}
};
CoffeescriptPlugin.prototype.render = function(opts) {
var coffee, compileOptions, file, fileFullPath, inExtension, key, outExtension, value, _ref1, _ref2;
inExtension = opts.inExtension, outExtension = opts.outExtension, file = opts.file;
if ((inExtension === 'coffee' || inExtension === 'litcoffee') && (outExtension === 'js' || outExtension === null)) {
coffee = require('coffee-script');
fileFullPath = file.get('fullPath');
compileOptions = {
filename: fileFullPath,
literate: coffee.helpers.isLiterate(fileFullPath)
};
_ref1 = this.getConfig().compileOptions;
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
value = _ref1[key];
if ((_ref2 = compileOptions[key]) == null) {
compileOptions[key] = value;
}
}
opts.content = coffee.compile(opts.content, compileOptions);
}
};
return CoffeescriptPlugin;
})(BasePlugin);
};