Installing Gulp in your project
Before we go any further, we must first initiate npm
for our project by running the following command in our console:
npm init
Answer the questions like those shown in the following screenshot:
The preceding command creates a new package.json
file; this file holds various metadata relevant to the project, and it also contains the dependencies for the project. The Gulp plugins you will install later on are all (dev) dependencies of your project.
Now install Gulp in your project, devDependencies
, by running the following command in your console:
npm install --save-dev gulp
The --save-dev
flag writes down Gulp as a devDependency
into the package.json
file.
Creating the Gulpfile.js which holds your tasks
Create a new file called Gulpfile.js
in your project directory and write down the following JavaScript code into it:
var gulp = require('gulp'); gulp.task('default', function() { // place code for your default...