humorHan/gulp

Forked from gulpjs/gulp

The streaming build system

http://gulpjs.com

Language: JavaScript


The streaming build system

NPM version Downloads Build Status Coveralls Status Gitter chat

What is gulp?

  • Automation - gulp is a toolkit that helps you automate painful or time-consuming tasks in your development workflow.
  • Platform-agnostic - Integrations are built into all major IDEs and people are using gulp with PHP, .NET, Node.js, Java, and other platforms.
  • Strong Ecosystem - Use npm modules to do anything you want + over 2000 curated plugins for streaming file transformations
  • Simple - By providing only a minimal API surface, gulp is easy to learn and simple to use

Documentation

For a Getting started guide, API docs, recipes, making a plugin, etc. check out our docs!

Sample gulpfile.js

This file will 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/**/*'
};

// Not all tasks need to use streams
// A gulpfile is just another node program and you can use any package available on npm
gulp.task('clean', function() {
  // You can use multiple globbing patterns as you would with `gulp.src`
  return del(['build']);
});

gulp.task('scripts', ['clean'], function() {
  // Minify and copy all JavaScript (except vendor scripts)
  // with sourcemaps all the way down
  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'));
});

// Copy all static images
gulp.task('images', ['clean'], function() {
  return gulp.src(paths.images)
    // Pass in options to the task
    .pipe(imagemin({optimizationLevel: 5}))
    .pipe(gulp.dest('build/img'));
});

// Rerun the task when a file changes
gulp.task('watch', function() {
  gulp.watch(paths.scripts, ['scripts']);
  gulp.watch(paths.images, ['images']);
});

// The default task (called when you run `gulp` from cli)
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 our Contributing guide!

Project Statistics

Sourcerank 0
Repository Size 1.57 MB
Stars 2
Forks 0
Watchers 1
Open issues disabled
Dependencies 27
Contributors 168
Tags 16
Created
Last updated
Last pushed

Top Contributors See all

contra Blaine Bublitz Sindre Sorhus Rob Richardson Tyler Kellen tomasz stryjewski Vsevolod Strukchinsky William Lubelski Steve Mao Callum Macrae Steve Lacy Nicholas Albion Arvind Ravulavaru James Crowley Leigh Yoshiya Hinosawa Larry Davis Peter deHaan Jason Jarrett Bo-Yi Wu

Recent Tags See all

v3.9.1 February 08, 2016
v3.9.0 June 01, 2015
v3.8.11 February 09, 2015
v3.8.10 November 04, 2014
v3.8.9 October 22, 2014
v3.8.8 September 07, 2014
v3.8.7 August 02, 2014
v3.8.6 July 09, 2014
v3.8.5 June 27, 2014
v3.8.4 June 27, 2014
v3.8.3 June 26, 2014
v3.8.1 June 18, 2014
3.8 June 10, 2014
3.7 June 01, 2014
3.5 January 25, 2014

Something wrong with this page? Make a suggestion

Last synced: 2016-10-25 04:29:45 UTC

Login to resync this repository