gulp = require('gulp'); var HubRegistry = require('gulp-hub'); /* load some files into the registry */ var hub = new HubRegistry(['tasks/*.js']); /* tell gulp to use the tasks just loaded */ gulp.registry(hub); gulpfile.js
require('run-sequence'); gulp.task('default', function(done) { runSequence( 'task_A', // Run A first ['task_B', 'task_C', 'task_D'], // B, C and D in parallel 'task_E', // then E done // Don't forget call callback ); }); gulp.task('task_A', ...); gulp.task('task_B', ...);
var size = require('gulp-size'); var changed = require('gulp-changed'); gulp.task('default', function() { var dest = 'app'; return gulp.src('src/*.js') .pipe(changed(dest)) // Pass only files that changed since the last time it was run .pipe(size({showFiles: true})) .pipe(gulp.dest(dest)) });
require('gulp'); var jade = require('gulp-jade'); var changed = require('gulp-changed'); gulp.task('jade', function () { var dest = 'app'; return gulp.src('src/**/*.jade') .pipe(changed(DEST, {extension: '.html'})) .pipe(jade()) .pipe(gulp.dest(dest)) });
var jade = require('gulp-jade'); var changed = require('gulp-changed'); gulp.task('jade', function () { var dest = 'app'; return gulp.src('src/**/*.jade') .pipe(changed(dest, {hasChanged: changed.compareSha1Digest})) .pipe(jade()) .pipe(gulp.dest(dest)) });
size = require('gulp-size'); var newer = require('gulp-newer'); gulp.task('default', function() { var dest = 'app'; return gulp.src('src/*.js') .pipe(newer(dest)) // Pass only files that changed since the last time it was run .pipe(size({showFiles: true})) .pipe(gulp.dest(dest)) });
gulp = require('gulp'); var concat = require('gulp-concat'); var newer = require('gulp-newer'); gulp.task('concat', function () { return gulp.src('src/*.js') // Pass all files if any one of them is newer than the destination file .pipe(newer('dist/all.js')) .pipe(concat('all.js')) .pipe(gulp.dest('dist')) });
var size = require('gulp-size'); gulp.task('default', function() { return gulp.src('src/**/*.txt') .pipe(size({showFiles: true})) // Show all files from gulp.src .pipe(gulp.dest('dist')); });