gulp - How to Use Gulp - gulp sass - gulp tutorial - learn gulp
What is gulp?
- Gulp.js is what we call a JavaScript Task Runner, it is Open Source and available on GitHub.
- It helps you automate repetitive tasks such as minification, compilation, unit testing, linting, etc.
- Gulp.js does not revolutionize automation but simplifies it tremendously.
Gulp Installation:
- To use Gulp, you need to install it as a global module first through NPM (if you're new to NPM, you can get to know it better in our Getting Started with NPM tutorial):
- Now we need to download Gulp and its plugins to our project. We will specify the plugins we're about to use in package.json:
- We list them in devDependencies because you'll typically run Gulp during the development stage.
- Now install the dependencies by running:
- This creates node_modules directory with all the plugins in the root of your project.
gulp tutorials tag - gulp , gulp sass , gulp watch , gulp meaning , gulp js , gulp uglify , concat javascript , eisi gulp , gulp concat , gulp install , gulp tutorial , what is gulp , npm install gulp , gulpjs
Using the First Plugin:
- Gulp relies on the plugins to do almost everything, so we need to learn how to use them.
- Now we will use a plug-in called gulp-util. Its purpose is to log custom messages to the terminal.
First, we need to load the plug-in:
After that we write task as in the previous case:
Here we called plug-in we defined as gutil, and called its log method with our custom message. Now we can run log task in the terminal:
gulp tutorials tag - gulp , gulp sass , gulp watch , gulp meaning , gulp js , gulp uglify , concat javascript , eisi gulp , gulp concat , gulp install , gulp tutorial , what is gulp , npm install gulp , gulpjs
Only 4 functions you need to learn in gulp to code :
- gulp.task
- gulp.watch
- gulp.src
- gulp.src