Gulp - the streaming build system

27
Gulp The streaming build system

description

Automating your workflow with Gulp.js

Transcript of Gulp - the streaming build system

Page 1: Gulp - the streaming build system

GulpThe streaming build system

Page 2: Gulp - the streaming build system

Gulp's use of streams and code over configurationmakes for a simpler and more intuitive build.

Page 3: Gulp - the streaming build system

Gulp vs Grunt

Stream-based build system.

Code over configuration.

Small, idiomatic Node modules.

Designed for big projects.

Really simple and elegant API

File-based build system.

Configuration over code.

Designed for small projects.

Page 4: Gulp - the streaming build system

Who uses Gulp ?

Page 5: Gulp - the streaming build system

And others: https://github.com/gulpjs/gulp/issues/540

Page 6: Gulp - the streaming build system

What people says ?

Page 7: Gulp - the streaming build system

Just switched a project from #gruntjs to #gulpjs - simpler code, & build time on save during

watch from 3-5sec to 10-20ms. I kid you not.

@andrewtjoslin

Page 8: Gulp - the streaming build system

Best part about @gulpjs is that people arewriting generic, streaming node modules

that have nothing to do with gulp except the module name :)

@maxogden

Page 9: Gulp - the streaming build system

Getting Started

Page 10: Gulp - the streaming build system

Install gulp globally$ npm install --global gulp

Page 11: Gulp - the streaming build system

Install gulp in your project devDependencies$ npm install --save-dev gulp

Page 12: Gulp - the streaming build system

Create a gulpfile.js at the root of your project

var gulp = require('gulp');

gulp.task('default', function() { // place code for your default task here});

Page 13: Gulp - the streaming build system

Run gulp$ gulp

Page 14: Gulp - the streaming build system

Streaming Builds

Page 15: Gulp - the streaming build system

Simple and elegant

gulp.src('static/less/*.less') .pipe(less())

.pipe(autoprefixer()) .pipe(cssmin()) .pipe(gulp.dest('static/css'));

*.less styles.min.cssless autoprefixer cssmin

Page 16: Gulp - the streaming build system

Read the Stream Handbook

Page 17: Gulp - the streaming build system

Gulp API

Page 18: Gulp - the streaming build system

gulp.task

gulp.task(name, function() {

// Do stuff

});

Page 19: Gulp - the streaming build system

gulp.watch

gulp.watch('static/less/*.less', ['compile']);

Page 20: Gulp - the streaming build system

gulp.srcReturns a readable stream

gulp.src('static/less/*.less')

Page 21: Gulp - the streaming build system

gulp.destReturns a "through stream"

gulp.src('static/less/*.less') .pipe(less()) .pipe(autoprefixer()) .pipe(cssmin()) .pipe(gulp.dest('static/css'));

Page 22: Gulp - the streaming build system

Gulp Generator

Page 23: Gulp - the streaming build system

Yeoman generator that scaffolds out a front-end web app using gulp for the build process.

https://github.com/yeoman/generator-gulp-webapp

Page 24: Gulp - the streaming build system

The streaming scaffolding system.Gulp as a replacement for Yeoman

http://slushjs.github.io/

Page 26: Gulp - the streaming build system

http://hmphry.com/gulp/

Page 27: Gulp - the streaming build system

GulpThe streaming build system

Sergey Romanenko

@AwilumIT