Reputation: 11188
I'm trying to leverage from Elixer so I started to get up and running. I've installed Node and Npm. Later I also installed Gulp using sudo npm install gulp -g
. But this installed Gulp in my project directory, resulting in a massive file transfer from my local host to the webserver. Is it necessary to install Gulp inside the project directory? Or is there a better way to install it somewhere else and use it for any project needed?
Sorry if this is a total beginners question but I can't seem to find an answer online. Thanks.
Upvotes: 1
Views: 1551
Reputation: 4895
Gulp
, bower
, ... are dependencies.
The command npm install ...
will download the module to the directory named node_modules
. They need to be (litterally) a part of your project. Think of it as a pure JS library (as it actually is).
Upvotes: 2
Reputation: 798
There is only few steps to start use it.
$ npm install --global gulp
$ npm install --save-dev gulp
gulpfile.js
in root dirThen in your new gulpfile do the follow:
var gulp = require('gulp');
gulp.task('default', function() {
// place code for your default task here
});
and after that just type gulp
command in terminal to execute default task
here is documentation to help you started with gulp docs and here you can find packages to use it npmjs.com
Tip: if you on OSX use sudo to install npm/jspm/gulp etc
Upvotes: 2
Reputation: 2134
sudo npm install gulp -g
shouldn't be installing gulp in your project directory. However, Gulp does always need to be installed locally in the project folder in order for it to work. Otherwise, you will get an error when trying to run Gulp. The -g
global installion of Gulp is only needed for linking the shell to the binary $ gulp
; it will dispatch to the local gulp program as soon as it is called.
Upvotes: 1