Gulp run deprecated

Since the latest version of gulp which no longer need to user the run() function for the logic, It make sense for me since the task function already take care of running the process.

First create a task like below example that compile coffeescript and minify it into javascript.

  var gulp = require('gulp'),
    coffee = require('gulp-coffee'),
    uglify = require('gulp-uglify');
  

  // define your file directory

  paths = {
    coffee: "./coffee/*.coffee"
    js:"./js"
  }


  // create an new task do compile coffeeScript
  gulp.task('coffeeScript', function(){
    gulp.src(paths.coffee)
    .pipe(coffee({bare:ture})) // options are allow here for coffee script
    .pipe(uglify()) // minify the javascript
    .pipe(gulp.dest(paths.js))
  });
  
  // watch the file changes...
  gulp.task('watch', function(){
      gulp.watch(paths.coffee, ['coffeeScript']);
  });
  
  // Gulp default function for proceed the gulp.
  gulp.task('default', ['coffeeScript', 'watch']);

anyway remember to update your node.js or else you will get an Bus Error.

  • wilsonjonash

    Such an elegant improvement. I love how gulp syntax is so terse.