First, we'll create a folder called project to server as our project root as we move through this tutorial. Run the npm init command from inside that directory:
The npm init command creates a package.json file for your project which stores information about the project, like the dependencies used in the project (Gulp is an example of a dependency).
npm init will prompt you:
Once the package.json file is created, we can install Gulp into the project by using the following command:
This time, we're installing Gulp into project instead of installing it globally, which is why there are some differences in the command.
You'll see that the sudo keyword isn't required because we're not installing Gulp globally, so -g is also not necessary. We've added --save-dev, which tells the computer to add gulp as a dev dependency in package.json.
If you check the project folder when the command has finished executing, you should see that Gulp has created a node_modules folder. You should also see a gulp folder within node_modules.
We're almost ready to start working with Gulp. Before we do so, we have to be clear on how we're going to use Gulp for the project, and part of that is deciding on a directory structure.
Click here for For next Step: "Determining Folder Structure in gulp"
Table of Contents: "Table of Contents to learn"
# ... from within our project folder
$ npm init
The npm init command creates a package.json file for your project which stores information about the project, like the dependencies used in the project (Gulp is an example of a dependency).
npm init will prompt you:
Once the package.json file is created, we can install Gulp into the project by using the following command:
$ npm install gulp --save-dev
This time, we're installing Gulp into project instead of installing it globally, which is why there are some differences in the command.
You'll see that the sudo keyword isn't required because we're not installing Gulp globally, so -g is also not necessary. We've added --save-dev, which tells the computer to add gulp as a dev dependency in package.json.
If you check the project folder when the command has finished executing, you should see that Gulp has created a node_modules folder. You should also see a gulp folder within node_modules.
We're almost ready to start working with Gulp. Before we do so, we have to be clear on how we're going to use Gulp for the project, and part of that is deciding on a directory structure.
Click here for For next Step: "Determining Folder Structure in gulp"
Table of Contents: "Table of Contents to learn"
Post a Comment