Skip to content

Instantly share code, notes, and snippets.

@zrobit
Created September 16, 2016 02:25
Show Gist options
  • Select an option

  • Save zrobit/29f0d89617a0a31c1644e463a7af84a9 to your computer and use it in GitHub Desktop.

Select an option

Save zrobit/29f0d89617a0a31c1644e463a7af84a9 to your computer and use it in GitHub Desktop.
gulp stylus bare task
var gulp = require('gulp'),
stylus = require('stylus'),
nib = require('nib'),
through = require('through2');
function stylus_raw(){
function stream(){
function compile(file, enc, cb){
var compiled;
var options = {
// Stylus options goes here :)
use: [nib()],
filename: file.path
};
compiled = stylus.render(String(file.contents), options);
file.path = file.path.substr(0, file.path.lastIndexOf(".")) + ".css";
file.contents = new Buffer(compiled);
cb(null, file);
}
return through.obj(compile);
}
return gulp.src(['styles/**/*.styl'])
.pipe(render())
.pipe(gulp.dest('build/'));
}
gulp.task('template:raw', stylus_raw);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment