SlideShare a Scribd company logo
Introduction to Gulp
Automate and enhance
your workflow
Hari Chand
Software Consultant
Knoldus software LLP
Agenda
●
What is Gulp?
●
Why Gulp?
●
Gulp workflow
●
API
●
Getting Started
●
Install Gulp
●
Demo
A BUILD SYSTEM
A TASK RUNNER
A WORKFLOW AUTOMATER
Automate your repetitive tasks like preprocessing,
minifying, concatenating and optimizing files
What is Gulp
Gulp is a task/build runner for development. It allows you to do a lot of stuff
within your development workflow. You can compile sass/less files, uglify
and compress js files and much more. The kicker for gulp is that its a
streaming build system which doesn't write temp files. It's like Pipes in bash.
● Front-end developement tool
● Task automation in javascript
● Streaming build system
Why use Gulp
●
Gulp solves the problem of repetition
●
Bundling and minifying libraries and stylesheets
●
Less/Sass to CSS compilation
●
Copying modified files to an output directory
●
Saving time
6
Gulp workflow
Gulp API
API Purpose
gulp.task Define a task
gulp.src Read files in
gulp.dest Write files out
gulp.watch Watch files for changes
gulp.task
gulp.task defines a task. A task contains the operations you want to execute,
where the operations are commonly provided by plugins.
name
The name of the task. The task name will be accessible via the CLI, so make it
something meaningful
dependencies
An optional array of tasks to be completed prior to your task
gulp.task
function
The function that performs the task’s operations. The function typically follows
the pattern of collecting files from the file system, performing some operations
provided by plugins, and writing the result back to the file system. We’ll take a
closer look at this later.
Below we are defining a task named template with a dependency on the
minify task. The minify task will be executed and completed prior to the
template task.
gulp.src
gulp.src will often be the first operation to perform within the task function as
it collects the files from the file system on which your task will operate. It
takes a file matching pattern (glob), representing the file structure to read,
and returns a readable stream.
glob
The node-glob file pattern to read. The glob simply refers to pattern matching
based on wildcard characters.
gulp.src
options
An optional parameter to further define file criteria, such as the Current Working
Directory, or whether your task needs the contents of the file read from the file
system. Occasionally you may just need the file path and not the contents.
Below example is collecting all files with the js file extension located in the
scripts directory or any of its subdirectories
gulp.dest
options
gulp.dest writes files to the specified path and is commonly the last step in the
task function.
path
The output directory path.
example writes the output files to the dist directory.
gulp.watch
gulp.watch performs one or more tasks when specified files change. To
avoid manually rerunning the build tasks after the developer makes
changes, the watch method can be configured to do this automatically by
executing certain tasks when particular files are changed
glob
The node-glob file pattern that indicates the files to monitor for changes.
options
An optional parameter to further define file criteria, such as the Current
Working Directory
gulp.watch
tasks
An array of tasks to be executed when a file changes.
Getting Started
Getting Started
$ npm install -g gulp
$ npm install –save-dev [plugin_name]
Create gulpfile.js & package.json
Create both of them at root directory
package.json
gulpfile.js
Thank You

More Related Content

ODP
GulpJs - An Introduction
PPTX
Introduction to Gulp
PPTX
JavaScript code academy - introduction
PPTX
JavaScript Task Runners - Gulp & Grunt
PDF
Gulp: Your Build Process Will Thank You
PDF
Gulp - the streaming build system
PDF
Improving your workflow with gulp
PDF
Intro to Gulp
GulpJs - An Introduction
Introduction to Gulp
JavaScript code academy - introduction
JavaScript Task Runners - Gulp & Grunt
Gulp: Your Build Process Will Thank You
Gulp - the streaming build system
Improving your workflow with gulp
Intro to Gulp

What's hot (20)

PDF
Gulp - The Streaming Build System
PPTX
Automated Development Workflow with Gulp
PPTX
Make JavaScript Lean, Mean, and Clean
PDF
sysprog2 Part2
ODP
Dockerfiles & Best Practices
PDF
SciPipe - A light-weight workflow library inspired by flow-based programming
PDF
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
PPTX
Writing data analysis pipeline as ruby gem
PDF
Headless approach and Acquia - Case study - Chris Ozog
PDF
Coffeescript intro
PDF
Web development tools { starter pack }
PPTX
PDF
Go performance tooling
PDF
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
PPTX
Introduction to Docker Compose
PDF
PostgreSQL and Compressed Documents (pgconf.ru 2018)
PDF
DOD 2016 - Sebastian Krzyszkowiak - Jenkins: The Pipeline
PDF
OpenCms Days 2013 - Gradle based OpenCms build automated setup
Gulp - The Streaming Build System
Automated Development Workflow with Gulp
Make JavaScript Lean, Mean, and Clean
sysprog2 Part2
Dockerfiles & Best Practices
SciPipe - A light-weight workflow library inspired by flow-based programming
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Writing data analysis pipeline as ruby gem
Headless approach and Acquia - Case study - Chris Ozog
Coffeescript intro
Web development tools { starter pack }
Go performance tooling
funcs, func expressions, closure, returning funcs, recursion, the stack -goph...
Introduction to Docker Compose
PostgreSQL and Compressed Documents (pgconf.ru 2018)
DOD 2016 - Sebastian Krzyszkowiak - Jenkins: The Pipeline
OpenCms Days 2013 - Gradle based OpenCms build automated setup
Ad

Viewers also liked (8)

PPTX
HCS 533 Week 6 Administrative Structure Power Point
PDF
Optimal Contrast Enhancement for Remote Sensing Images
PDF
Blanca_M_Martinez_Portfolio
DOCX
English 2
PDF
041916-HBP-Media Packet-Complete
PDF
MIP AND UNSUPERVISED CLUSTERING FOR THE DETECTION OF BRAIN TUMOUR CELLS
PDF
Personalizing Image Search from the Photo Sharing Websites
PDF
HCS 533 Week 6 Administrative Structure Power Point
Optimal Contrast Enhancement for Remote Sensing Images
Blanca_M_Martinez_Portfolio
English 2
041916-HBP-Media Packet-Complete
MIP AND UNSUPERVISED CLUSTERING FOR THE DETECTION OF BRAIN TUMOUR CELLS
Personalizing Image Search from the Photo Sharing Websites
Ad

Similar to Introduction to GulpJs (20)

PDF
Angular workflow with gulp.js
PDF
Automating Large Applications on Modular and Structured Form with Gulp
PPTX
Gulp and bower Implementation
PPTX
Getting Started with Gulp
PDF
Getting started with gulpjs
PPTX
Automating WordPress Plugin Development with Gulp
PDF
Gulp and Compass
PPTX
Node js Global Packages
PPTX
Android presentation - Gradle ++
PPTX
Gulp: Task Runner
PDF
Plumbin Pipelines - A Gulp.js workshop
PPTX
Mono Repo
PDF
Demo 0.9.4
PPTX
Modern web technologies
PPTX
Gulp js
PDF
Drupal Best Practices
PPTX
Introduction to go lang
ODP
Laziness with Gulp
Angular workflow with gulp.js
Automating Large Applications on Modular and Structured Form with Gulp
Gulp and bower Implementation
Getting Started with Gulp
Getting started with gulpjs
Automating WordPress Plugin Development with Gulp
Gulp and Compass
Node js Global Packages
Android presentation - Gradle ++
Gulp: Task Runner
Plumbin Pipelines - A Gulp.js workshop
Mono Repo
Demo 0.9.4
Modern web technologies
Gulp js
Drupal Best Practices
Introduction to go lang
Laziness with Gulp

Recently uploaded (20)

PPTX
Introuction about WHO-FIC in ICD-10.pptx
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
artificial intelligence overview of it and more
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PPTX
Funds Management Learning Material for Beg
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
presentation_pfe-universite-molay-seltan.pptx
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPT
tcp ip networks nd ip layering assotred slides
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PDF
Testing WebRTC applications at scale.pdf
Introuction about WHO-FIC in ICD-10.pptx
RPKI Status Update, presented by Makito Lay at IDNOG 10
SAP Ariba Sourcing PPT for learning material
artificial intelligence overview of it and more
An introduction to the IFRS (ISSB) Stndards.pdf
Tenda Login Guide: Access Your Router in 5 Easy Steps
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
Funds Management Learning Material for Beg
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
presentation_pfe-universite-molay-seltan.pptx
WebRTC in SignalWire - troubleshooting media negotiation
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
Power Point - Lesson 3_2.pptx grad school presentation
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Slides PPTX World Game (s) Eco Economic Epochs.pptx
tcp ip networks nd ip layering assotred slides
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Testing WebRTC applications at scale.pdf

Introduction to GulpJs

  • 1. Introduction to Gulp Automate and enhance your workflow Hari Chand Software Consultant Knoldus software LLP
  • 2. Agenda ● What is Gulp? ● Why Gulp? ● Gulp workflow ● API ● Getting Started ● Install Gulp ● Demo
  • 3. A BUILD SYSTEM A TASK RUNNER A WORKFLOW AUTOMATER Automate your repetitive tasks like preprocessing, minifying, concatenating and optimizing files
  • 4. What is Gulp Gulp is a task/build runner for development. It allows you to do a lot of stuff within your development workflow. You can compile sass/less files, uglify and compress js files and much more. The kicker for gulp is that its a streaming build system which doesn't write temp files. It's like Pipes in bash. ● Front-end developement tool ● Task automation in javascript ● Streaming build system
  • 5. Why use Gulp ● Gulp solves the problem of repetition ● Bundling and minifying libraries and stylesheets ● Less/Sass to CSS compilation ● Copying modified files to an output directory ● Saving time
  • 7. Gulp API API Purpose gulp.task Define a task gulp.src Read files in gulp.dest Write files out gulp.watch Watch files for changes
  • 8. gulp.task gulp.task defines a task. A task contains the operations you want to execute, where the operations are commonly provided by plugins. name The name of the task. The task name will be accessible via the CLI, so make it something meaningful dependencies An optional array of tasks to be completed prior to your task
  • 9. gulp.task function The function that performs the task’s operations. The function typically follows the pattern of collecting files from the file system, performing some operations provided by plugins, and writing the result back to the file system. We’ll take a closer look at this later. Below we are defining a task named template with a dependency on the minify task. The minify task will be executed and completed prior to the template task.
  • 10. gulp.src gulp.src will often be the first operation to perform within the task function as it collects the files from the file system on which your task will operate. It takes a file matching pattern (glob), representing the file structure to read, and returns a readable stream. glob The node-glob file pattern to read. The glob simply refers to pattern matching based on wildcard characters.
  • 11. gulp.src options An optional parameter to further define file criteria, such as the Current Working Directory, or whether your task needs the contents of the file read from the file system. Occasionally you may just need the file path and not the contents. Below example is collecting all files with the js file extension located in the scripts directory or any of its subdirectories
  • 12. gulp.dest options gulp.dest writes files to the specified path and is commonly the last step in the task function. path The output directory path. example writes the output files to the dist directory.
  • 13. gulp.watch gulp.watch performs one or more tasks when specified files change. To avoid manually rerunning the build tasks after the developer makes changes, the watch method can be configured to do this automatically by executing certain tasks when particular files are changed glob The node-glob file pattern that indicates the files to monitor for changes. options An optional parameter to further define file criteria, such as the Current Working Directory
  • 14. gulp.watch tasks An array of tasks to be executed when a file changes.
  • 16. Getting Started $ npm install -g gulp $ npm install –save-dev [plugin_name] Create gulpfile.js & package.json Create both of them at root directory

Editor's Notes

  • #18: To setup an Automated Build Create a Docker Hub account and login. Link your GitHub or Bitbucket account through the “Link Accounts” menu. Configure an Automated Build. Pick a GitHub or Bitbucket project that has a Dockerfile that you want to build. Pick the branch you want to build (the default is the master branch). Give the Automated Build a name. Assign an optional Docker tag to the Build. Specify where the Dockerfile is located. The default is /. Once the Automated Build is configured it will automatically trigger a build and, in a few minutes, you should see your new Automated Build on the Docker Hub Registry. It will stay in sync with your GitHub and Bitbucket repository until you deactivate the Automated Build.