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.
 
 
 

52 lines
1.7 KiB

// Generated by CoffeeScript 1.4.0
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 StylusPlugin;
return StylusPlugin = (function(_super) {
__extends(StylusPlugin, _super);
function StylusPlugin() {
return StylusPlugin.__super__.constructor.apply(this, arguments);
}
StylusPlugin.prototype.name = 'stylus';
StylusPlugin.prototype.config = {
useNib: true,
compress: true,
environments: {
development: {
compress: false
}
}
};
StylusPlugin.prototype.render = function(opts, next) {
var content, file, inExtension, nib, outExtension, style, stylus;
inExtension = opts.inExtension, outExtension = opts.outExtension, content = opts.content, file = opts.file;
if ((inExtension === 'styl' || inExtension === 'stylus') && (outExtension === 'css' || outExtension === null)) {
stylus = require('stylus');
style = stylus(opts.content).set('filename', file.get('fullPath')).set('compress', this.config.compress);
if (this.config.useNib) {
nib = require('nib');
style.use(nib());
}
return style.render(function(err, output) {
if (err) {
return next(err);
}
opts.content = output;
return next();
});
} else {
return next();
}
};
return StylusPlugin;
})(BasePlugin);
};