On Github ZKM / gulp-lightning-talk
Created by Zach Schneider / @zkm
Gulp is an automated task runner — or build process.
You got this Zach, no pressure.Speedtesting between gulp.js and Grunt
Sass compilation
Javascript minification and concatination using Uglify.js
Here is an example of a gruntfile.js
grunt.initConfig({ sass: { dist: { files: [{ cwd: 'app/styles', src: '**/*.scss', dest: '../.tmp/styles', expand: true, ext: '.css' }] } }, autoprefixer: { options: ['last 1 version'], dist: { files: [{ expand: true, cwd: '.tmp/styles', src: '{,*/}*.css', dest: 'dist/styles' }] } }, watch: { styles: { files: ['app/styles/{,*/}*.scss'], tasks: ['sass:dist', 'autoprefixer:dist'] } } }); grunt.registerTask('default', ['styles', 'watch']);
Now here is an example of a gulpfile.js doing the same thing.
gulp.task('sass', function () { gulp.src('app/styles/**/*.scss') .pipe(sass()) .pipe(autoprefixer('last 1 version')) .pipe(gulp.dest('dist/styles')); }); gulp.task('default', function() { gulp.run('sass'); gulp.watch('app/styles/**/*.scss', function() { gulp.run('sass'); }); });
Leonardo da Vinci once said
“Simplicity is the ultimate sophistication.”var gulp = require('gulp'); var gutil = require('gulp-util'); gulp.task('default', function(){ // Default task code });Now run gulp from the command line and watch the magic. This slide has fragments which are also stepped through in the notes window.
If you are looking for a simple and fast task runner solution, I would recommend using Gulp.