Created
September 16, 2014 15:04
-
-
Save kbshl/ec3afaee994c04b4dd29 to your computer and use it in GitHub Desktop.
Gulp Receipe: Only pass through changed files
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
// Files are passed through the whole pipe chain on every run by default. By using gulp-changed only changed files will be passed through. This can speed up consecutive runs considerably. | |
// npm install --save-dev gulp gulp-changed gulp-jscs gulp-uglify | |
var gulp = require('gulp'); | |
var changed = require('gulp-changed'); | |
var jscs = require('gulp-jscs'); | |
var uglify = require('gulp-uglify'); | |
// we define some constants here so they can be reused | |
var SRC = 'src/*.js'; | |
var DEST = 'dist'; | |
gulp.task('default', function() { | |
return gulp.src(SRC) | |
// the `changed` task needs to know the destination directory | |
// upfront to be able to figure out which files changed | |
.pipe(changed(DEST)) | |
// only files that has changed will pass through here | |
.pipe(jscs()) | |
.pipe(uglify()) | |
.pipe(gulp.dest(DEST)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment