Hello Gulp

Learning Gulp : part 2 of 22 published on Jun 26, 2015

Let’s start a new node project in our folder and add a package.json.

$ npm init
// /package.json
{
  "name": "learning_gulp",
  "version": "0.0.0",
  "description": "A sample project to learn how Gulp works",
  "main": "index.js",
  "author": "YOUR_NAME_HERE",
  "license": "ISC"
}

Time to install gulp using npm. First globally to access the gulp command and then locally for our package.json.

$ npm install gulp -g
$ npm install gulp --save-dev

By default gulp looks for a gulpfile.js to run. Let’s create a simple gulpfile.js.

// /gulpfile.js
var gulp = require('gulp');

gulp.task('default', [], function() {
  console.log("Hello Gulp! You are mighty fine.");
});

In your terminal run the gulp command.

$ gulp

You should see:

Using gulpfile ~/YOUR_DIRECTORY/gulpfile.js
Starting 'default'...
Hello Gulp! You are mighty fine.
Finished 'default' after 118 μs

Congratulations creating your first gulp build script!

Next: Moving Files with Gulp