gulp
The streaming build system
![Gitter chat](https://badges.gitter.im/gulpjs/gulp.png)
Like what we do?
Support us via Gratipay
Documentation
For a Getting started guide, API docs, recipes, making a plugin, etc. see the documentation page!
Sample gulpfile.js
This file is just a quick sample to give you a taste of what gulp does.
var gulp = require('gulp');
var coffee = require('gulp-coffee');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');
var sourcemaps = require('gulp-sourcemaps');
var del = require('del');
var paths = {
scripts: ['client/js/**/*.coffee', '!client/external/**/*.coffee'],
images: 'client/img/**/*'
};
gulp.task('clean', function(cb) {
del(['build'], cb);
});
gulp.task('scripts', ['clean'], function() {
return gulp.src(paths.scripts)
.pipe(sourcemaps.init())
.pipe(coffee())
.pipe(uglify())
.pipe(concat('all.min.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('build/js'));
});
gulp.task('images', ['clean'], function() {
return gulp.src(paths.images)
.pipe(imagemin({optimizationLevel: 5}))
.pipe(gulp.dest('build/img'));
});
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.images, ['images']);
});
gulp.task('default', ['watch', 'scripts', 'images']);
Incremental Builds
We recommend these plugins:
- gulp-changed - only pass through changed files
- gulp-cached - in-memory file cache, not for operation on sets of files
- gulp-remember - pairs nicely with gulp-cached
- gulp-newer - pass through newer source files only, supports many:1 source:dest
Want to contribute?
Anyone can help make this project better - check out the Contributing guide!
![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/wearefractal/gulp/trend.png)