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

  1. // Generated by CoffeeScript 1.6.2
  2. var __hasProp = {}.hasOwnProperty,
  3. __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; };
  4. module.exports = function(BasePlugin) {
  5. var CoffeescriptPlugin, _ref;
  6. return CoffeescriptPlugin = (function(_super) {
  7. __extends(CoffeescriptPlugin, _super);
  8. function CoffeescriptPlugin() {
  9. _ref = CoffeescriptPlugin.__super__.constructor.apply(this, arguments);
  10. return _ref;
  11. }
  12. CoffeescriptPlugin.prototype.name = 'coffeescript';
  13. CoffeescriptPlugin.prototype.config = {
  14. compileOptions: {}
  15. };
  16. CoffeescriptPlugin.prototype.render = function(opts) {
  17. var coffee, compileOptions, file, fileFullPath, inExtension, key, outExtension, value, _ref1, _ref2;
  18. inExtension = opts.inExtension, outExtension = opts.outExtension, file = opts.file;
  19. if ((inExtension === 'coffee' || inExtension === 'litcoffee') && (outExtension === 'js' || outExtension === null)) {
  20. coffee = require('coffee-script');
  21. fileFullPath = file.get('fullPath');
  22. compileOptions = {
  23. filename: fileFullPath,
  24. literate: coffee.helpers.isLiterate(fileFullPath)
  25. };
  26. _ref1 = this.getConfig().compileOptions;
  27. for (key in _ref1) {
  28. if (!__hasProp.call(_ref1, key)) continue;
  29. value = _ref1[key];
  30. if ((_ref2 = compileOptions[key]) == null) {
  31. compileOptions[key] = value;
  32. }
  33. }
  34. opts.content = coffee.compile(opts.content, compileOptions);
  35. }
  36. };
  37. return CoffeescriptPlugin;
  38. })(BasePlugin);
  39. };