Skip to content

Instantly share code, notes, and snippets.

@markgoodyear
Last active August 29, 2015 13:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save markgoodyear/9100177 to your computer and use it in GitHub Desktop.
Save markgoodyear/9100177 to your computer and use it in GitHub Desktop.
Example of a dev flag for gulp
// Define your plugins here, make sure you have `gulp-util`...
var gutil = require('gulp-util');
/**
* Define dev CLI flag
* Run `gulp --dev`
*/
var isDev = gutil.env.dev;
gulp.task('scripts', function() {
return gulp.src('src/scripts/*/**.js')
.pipe(concat('main.js'))
.pipe(gulpif(!isDev, $.uglify())) // If we use the `--dev` flag, uglify will not take place.
.pipe(gulp.dest('dist/scripts'))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment