SlideShare a Scribd company logo
Getting started with GULP
Unmesh Dusane
Front End Geek
What is GULP ?
1. In simple word it is “task runner” that automate your daily repetitive task such as
SCSS/SASS compilation , minimizing js/css files ,code analysis, automatically refresh
browser when you changed file etc.
2. It is command line task runner utilizing node.js platform. It runs custom defined
repetition task and manage process automation.
Why ?
- It uses node stream, piping out from one task to as an input to other task, process it
through multiple task and then write the output file. The result it faster build because
there is no need to create and read intermediary files on hard drive.
- used to do repetitive and time consuming task e.g you want minify you project file that
has few css, html, and js . before pointing these into production you may need to minify
css and js file for optimization.so every time you make a change to css and js you again
have to minify them . this is where gulp comes you define all regular task in gulpfile.js
and just run it. gulp minify css, js, and keeps ready for production environment project
Step to install gulp
1. Install node (https://nodejs.org/en/download/) . after installation check node is installed
or not.
2. Go to project directory > create package.json file or just type npm init
3. Installing gulp (npm - it is package manager for Node that enable you to install
additional module for use in your projects from the command line)
npm install -g gulp (here npm in the application we are using to install our package ,
-g is optional flag used to signify that we want to install this package globally so an
project can use it gulp is name of package)
4. Install gulp locally using npm install --save-dev gulp . It is used to instruct npm to add
dependency to our devDependecies list in our package.json file.Dependencies help us
to organize which package are needed in our development and production environment
Step to install gulp(continue)
5. Setting up gulpfile and running gulp - once gulp in installed we have to give it
instruction so it know what task for perform for us
6. Install required plugins - npm install gulp-sass gulp-concat gulp-ugilfy gulp-rename
--save-dev
7. Create our gulpfile.js - now all plugins are available for us to use, we can start writing
out gulpfile and instructing gulp to perform tasks
Gulp task
1. Basically gulp has only 5 method task, watch, run, src and dest
2. All gulp configuration goes in gulpfile.js file in root folder of your project
3. A pattern of writing gulp task is to load plugin you are about to use and then define the
task which is based on that plugin.
4. First we load gulp plugin using Node.js and its require function
e.g var gulp = require('gulp');
5. Now, we can create our first task. A basic form of a task look like
gulp.task('name',function(){ // implementation of the task
});
Here we call gulp object and call its task method, It takes two argument name and
function literal or array of the other task.
Gulp task (continue)
e.g suppose we want to create task that compile sass file to css .
install gulp-sass plugin from root project folder using command
“npm install gulp-sass --save-dev” . then in gulpfile.js include this plugin as
var sass = require('gulp-sass');
gulp.task('sass',function(){
gulp.src('style/scss/main.scss')
.pipe(sass())
.pipe(gulp.dest('style/css'));
});
Here we created sass task which piped main.scss file to sass object and as an argument we
passed an object with potion we want it use
- Most imp method of gulp are src ,dest and pipe . src is used to put name of file we want to work
and use as an input . pipe will take output of the prev command as pipe it as an input to the next.
dest write the output of prev command to the folder we specify
How to run gulp task
- To run any task use following command from root folder
gulp taskname
- To run previous sass task that we created run “gulp sass” command.
- Finally, we have our default task which is used as a grouped reference to our other
tasks. This will be the task that is ran upon entering gulp into the command line without
any additional parameters.
gulp.task('default', ['sass','scripts']);
Here sass , script are task name that we want to run default
- gulp - this will call gulp and run everything we have defined in default ,so it is same as
gulp default
Task (minify and concat)
- Suppose we want to create task that will compile our assets e.g minimizing and
concatenating script together so that the server loads the page faster.
install gulp-uglify,gulp-concat plugin
Gulpfile.js
var uglify = require('gulp-uglify');
concat = require('gulp-concat');
gulp.task('js',function(){
gulp.src('scripts/*.js');
.pipe(uglify())
.pipe(concat('script.js'))
.pipe(gulp.desc('assets'))
});
Task : watching for file change
- Suppose we want to create task that will watch if any change happen on file and do
respected task . We do this using watch method of gulp object.
so ,
gulp.task('dowatch',function(){
gulp.watch('styles/main.scss',['sass']);
});
this task watch styles/main.scss file, if user change the file content then sass task will
get run which will compile scss to css

More Related Content

PPTX
Automated Development Workflow with Gulp
PDF
Frontend JS workflow - Gulp 4 and the like
PPTX
Introduction to Gulp
PPTX
Gulp: Task Runner
PPTX
Gulp and bower Implementation
PDF
Gulp: Your Build Process Will Thank You
PDF
Devenez le plus heureux des Front-end avec Gulp.js
PPTX
JavaScript Task Runners - Gulp & Grunt
Automated Development Workflow with Gulp
Frontend JS workflow - Gulp 4 and the like
Introduction to Gulp
Gulp: Task Runner
Gulp and bower Implementation
Gulp: Your Build Process Will Thank You
Devenez le plus heureux des Front-end avec Gulp.js
JavaScript Task Runners - Gulp & Grunt

What's hot (20)

PDF
GDG Kraków - Intro to front-end automation using bower.js & grunt.js
PPTX
Introduction to using Grunt & Bower with WordPress theme development
PDF
Gulp - The Streaming Build System
PDF
Automating your workflow with Gulp.js
PDF
The Secrets of The FullStack Ninja - Part A - Session I
ODP
GulpJs - An Introduction
PDF
Modernizing Your WordPress Workflow with Grunt & Bower
PPTX
Grunt and Bower
PPTX
Improving WordPress Theme Development Workflow - Naveen Kharwar.
PDF
How we maintain 200+ Drupal sites in Georgetown University
PPTX
JavaScript code academy - introduction
PPTX
Grunt - The JavaScript Task Runner
PPTX
Bower - A package manager for the web
PDF
Introduction to Express and Grunt
PPT
Yeoman
PDF
Automating Front-End Workflow
PDF
Npm: beyond 'npm i'
PPT
Capistrano
PDF
Create a Varnish cluster in Kubernetes for Drupal caching - DrupalCon North A...
PPTX
Modern web technologies
GDG Kraków - Intro to front-end automation using bower.js & grunt.js
Introduction to using Grunt & Bower with WordPress theme development
Gulp - The Streaming Build System
Automating your workflow with Gulp.js
The Secrets of The FullStack Ninja - Part A - Session I
GulpJs - An Introduction
Modernizing Your WordPress Workflow with Grunt & Bower
Grunt and Bower
Improving WordPress Theme Development Workflow - Naveen Kharwar.
How we maintain 200+ Drupal sites in Georgetown University
JavaScript code academy - introduction
Grunt - The JavaScript Task Runner
Bower - A package manager for the web
Introduction to Express and Grunt
Yeoman
Automating Front-End Workflow
Npm: beyond 'npm i'
Capistrano
Create a Varnish cluster in Kubernetes for Drupal caching - DrupalCon North A...
Modern web technologies
Ad

Similar to Getting started with gulpjs (20)

ODP
Introduction to GulpJs
PDF
Angular workflow with gulp.js
PDF
Web development tools { starter pack }
PPTX
Gulp js
PDF
Intro to Gulp
PDF
Plumbin Pipelines - A Gulp.js workshop
PPTX
Take A Gulp at Task Automation
PDF
Automating Large Applications on Modular and Structured Form with Gulp
PDF
Time's Important - Let Task Management Save Yours
PDF
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
PPT
Npmgruntgulp
PPTX
Word press workflows and gulp
PDF
Building workflow in Javascript: Build the awesome with Gulp.
PDF
Building workflow in Javascript: Build the awesome with Gulp.
PPTX
Automating Your Workflow with Gulp.js - php[world] 2016
PDF
Improving your workflow with gulp
PDF
Quest for the Perfect Workflow for McrFRED
PDF
Forget Grunt and Gulp! Webpack and NPM rule them all!
Introduction to GulpJs
Angular workflow with gulp.js
Web development tools { starter pack }
Gulp js
Intro to Gulp
Plumbin Pipelines - A Gulp.js workshop
Take A Gulp at Task Automation
Automating Large Applications on Modular and Structured Form with Gulp
Time's Important - Let Task Management Save Yours
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
Npmgruntgulp
Word press workflows and gulp
Building workflow in Javascript: Build the awesome with Gulp.
Building workflow in Javascript: Build the awesome with Gulp.
Automating Your Workflow with Gulp.js - php[world] 2016
Improving your workflow with gulp
Quest for the Perfect Workflow for McrFRED
Forget Grunt and Gulp! Webpack and NPM rule them all!
Ad

Recently uploaded (20)

PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Essential Infomation Tech presentation.pptx
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
System and Network Administraation Chapter 3
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
history of c programming in notes for students .pptx
PDF
top salesforce developer skills in 2025.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
PTS Company Brochure 2025 (1).pdf.......
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Essential Infomation Tech presentation.pptx
wealthsignaloriginal-com-DS-text-... (1).pdf
Wondershare Filmora 15 Crack With Activation Key [2025
VVF-Customer-Presentation2025-Ver1.9.pptx
Which alternative to Crystal Reports is best for small or large businesses.pdf
Design an Analysis of Algorithms II-SECS-1021-03
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Transform Your Business with a Software ERP System
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
System and Network Administraation Chapter 3
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
How to Choose the Right IT Partner for Your Business in Malaysia
Upgrade and Innovation Strategies for SAP ERP Customers
history of c programming in notes for students .pptx
top salesforce developer skills in 2025.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PTS Company Brochure 2025 (1).pdf.......

Getting started with gulpjs

  • 1. Getting started with GULP Unmesh Dusane Front End Geek
  • 2. What is GULP ? 1. In simple word it is “task runner” that automate your daily repetitive task such as SCSS/SASS compilation , minimizing js/css files ,code analysis, automatically refresh browser when you changed file etc. 2. It is command line task runner utilizing node.js platform. It runs custom defined repetition task and manage process automation.
  • 3. Why ? - It uses node stream, piping out from one task to as an input to other task, process it through multiple task and then write the output file. The result it faster build because there is no need to create and read intermediary files on hard drive. - used to do repetitive and time consuming task e.g you want minify you project file that has few css, html, and js . before pointing these into production you may need to minify css and js file for optimization.so every time you make a change to css and js you again have to minify them . this is where gulp comes you define all regular task in gulpfile.js and just run it. gulp minify css, js, and keeps ready for production environment project
  • 4. Step to install gulp 1. Install node (https://nodejs.org/en/download/) . after installation check node is installed or not. 2. Go to project directory > create package.json file or just type npm init 3. Installing gulp (npm - it is package manager for Node that enable you to install additional module for use in your projects from the command line) npm install -g gulp (here npm in the application we are using to install our package , -g is optional flag used to signify that we want to install this package globally so an project can use it gulp is name of package) 4. Install gulp locally using npm install --save-dev gulp . It is used to instruct npm to add dependency to our devDependecies list in our package.json file.Dependencies help us to organize which package are needed in our development and production environment
  • 5. Step to install gulp(continue) 5. Setting up gulpfile and running gulp - once gulp in installed we have to give it instruction so it know what task for perform for us 6. Install required plugins - npm install gulp-sass gulp-concat gulp-ugilfy gulp-rename --save-dev 7. Create our gulpfile.js - now all plugins are available for us to use, we can start writing out gulpfile and instructing gulp to perform tasks
  • 6. Gulp task 1. Basically gulp has only 5 method task, watch, run, src and dest 2. All gulp configuration goes in gulpfile.js file in root folder of your project 3. A pattern of writing gulp task is to load plugin you are about to use and then define the task which is based on that plugin. 4. First we load gulp plugin using Node.js and its require function e.g var gulp = require('gulp'); 5. Now, we can create our first task. A basic form of a task look like gulp.task('name',function(){ // implementation of the task }); Here we call gulp object and call its task method, It takes two argument name and function literal or array of the other task.
  • 7. Gulp task (continue) e.g suppose we want to create task that compile sass file to css . install gulp-sass plugin from root project folder using command “npm install gulp-sass --save-dev” . then in gulpfile.js include this plugin as var sass = require('gulp-sass'); gulp.task('sass',function(){ gulp.src('style/scss/main.scss') .pipe(sass()) .pipe(gulp.dest('style/css')); }); Here we created sass task which piped main.scss file to sass object and as an argument we passed an object with potion we want it use - Most imp method of gulp are src ,dest and pipe . src is used to put name of file we want to work and use as an input . pipe will take output of the prev command as pipe it as an input to the next. dest write the output of prev command to the folder we specify
  • 8. How to run gulp task - To run any task use following command from root folder gulp taskname - To run previous sass task that we created run “gulp sass” command. - Finally, we have our default task which is used as a grouped reference to our other tasks. This will be the task that is ran upon entering gulp into the command line without any additional parameters. gulp.task('default', ['sass','scripts']); Here sass , script are task name that we want to run default - gulp - this will call gulp and run everything we have defined in default ,so it is same as gulp default
  • 9. Task (minify and concat) - Suppose we want to create task that will compile our assets e.g minimizing and concatenating script together so that the server loads the page faster. install gulp-uglify,gulp-concat plugin Gulpfile.js var uglify = require('gulp-uglify'); concat = require('gulp-concat'); gulp.task('js',function(){ gulp.src('scripts/*.js'); .pipe(uglify()) .pipe(concat('script.js')) .pipe(gulp.desc('assets')) });
  • 10. Task : watching for file change - Suppose we want to create task that will watch if any change happen on file and do respected task . We do this using watch method of gulp object. so , gulp.task('dowatch',function(){ gulp.watch('styles/main.scss',['sass']); }); this task watch styles/main.scss file, if user change the file content then sass task will get run which will compile scss to css