Last active
December 3, 2015 21:31
-
-
Save mlms13/6a1c61e8a8cdf4d025f1 to your computer and use it in GitHub Desktop.
Conditionally switch between source maps and minification based on a gulp flag.
This file contains 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
// `gulp stylus --prod` will enable "production mode" | |
// `gulp stylus` will leave the prod flag undefined, so it will do a dev build | |
var gulp = require('gulp'), | |
gutil = require('gulp-util'), | |
prod = gulp.env.prod; | |
gulp.task('stylus', ['cleancss'], function () { | |
var stylus = require('gulp-stylus'), | |
prefix = require('gulp-autoprefixer'), | |
minify = require('gulp-minify-css'); | |
return gulp.src('./styl/main.styl') | |
.pipe(stylus({linenos: !prod})) | |
.pipe(prod ? prefix() : gutil.noop()) | |
.pipe(prod ? minify() : gutil.noop()) | |
.pipe(gulp.dest('./dist/css')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment