Created
September 16, 2016 02:25
-
-
Save zrobit/29f0d89617a0a31c1644e463a7af84a9 to your computer and use it in GitHub Desktop.
gulp stylus bare task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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