Skip to content

Instantly share code, notes, and snippets.

@gruzzilkin
Created August 27, 2014 07:13
Show Gist options
  • Save gruzzilkin/c1cad797cc267e4c910f to your computer and use it in GitHub Desktop.
Save gruzzilkin/c1cad797cc267e4c910f to your computer and use it in GitHub Desktop.
Custom "stylus + if-ie.styl + autoprefixer" tech for ENB project. Destination `.bem/techs`
var autoprefixer = require('autoprefixer');
module.exports = require('enb-stylus/techs/css-stylus').buildFlow()
.name('css-stylus-with-if-ie')
.defineOption('browsers')
.defineOption('autoprefixerArguments')
.methods({
_configureRenderer: function(renderer) {
var args = this._browsers || this._autoprefixerArguments;
renderer.include('./node_modules');
renderer.import('if-ie.styl/if-ie');
renderer.use(function (style) {
this.on('end', function (err, css) {
return args ?
autoprefixer.apply(this, {browsers: args}).process(css).css :
autoprefixer.process(css).css;
});
});
return renderer;
}
})
.createTech();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment