If you've previously installed gulp globally, run npm rm --global gulp
before following these instructions. For more information, read this Sip.
Make sure that you've installed Node and npm before attempting to install gulp.
node --version
npm --version
npm install --global gulp-cli
If you don't have a package.json, create one. If you need help, run an npm init
which will walk you through giving it a name, version, description, etc.
Run this command in your project directory:
npm install --save-dev gulp@next
In your project directory, create a file named gulpfile.js
in your project root with these contents:
var gulp = require('gulp');
gulp.task('default', defaultTask);
function defaultTask(done) {
// place code for your default task here
done();
}
Run the gulp command in your project directory:
gulp
To run multiple tasks, you can use gulp <task> <othertask>
.
Voila! The default task will run and do nothing.
Using gulpfile ~/my-project/gulpfile.js
[11:15:51] Starting 'default'...
[11:15:51] Finished 'default' after 103 μs
For API specific documentation, you can check out the documentation for that.
- API Documentation - The programming interface, defined
- Recipes - Specific examples from the community
- In Depth Help - A tutorial from the guy who wrote the book
- Plugins - Building blocks for your gulp file