On Github tmartineau / a-look-at-gulp
Gulp is a streaming build system for web applications.
Ok why does this matter and how is it different then... say Grunt?
//gulpfile.js var gulp = require('gulp'); var minifycss = require('gulp-minify-css'); var autoprefixer = require('gulp-autoprefixer');
concat: { options: { separator: ';' }, dist: { src: ['./lib/**/*.js'], dest: 'dist/all.js' } }
$ npm install gulp -g $ npm install gulp --save-dev
$ npm install gulp-minify-css --save-dev $ npm install gulp-autoprefixer --save-dev
Maybe you have some SASS in your project you want compiled
//gulpfile.js gulp.task('sass', function () { return gulp.src('sass/**/*.sass') .pipe(sass({ style: 'compressed' })) .pipe(autoprefixer('last 15 version')) .pipe(minifycss()) .pipe(gulp.dest('css')) .pipe(notify({ message: 'Easy isn\'t it Ottawa JS?' })); });
$ gulp
By default Gulp looks for the default task. We could change the task name but then it is not as descriptive. Or we tell Gulp what task to run:
$ gulp sass
gulp.task('sass', function () { ... }); gulp.task('default', ['sass']);