Last active
August 29, 2015 13:56
-
-
Save markgoodyear/9100177 to your computer and use it in GitHub Desktop.
Example of a dev flag for gulp
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
// 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