SlideShare a Scribd company logo
Gulp : Task Runner
For Node Fundamentals @ BCIT
What is
Gulp?
End
Uses
Install
Plugins
Features
Linting
Preprocessing
Asset OptimizationPrepare
Distribution
Templating
Project
Interpolation
Minify JS/CSS
? ?
?
?
?
LESS/SASS
Unit Tests
Coffeescript
What is Gulp?
● Build
system/Automation
● Built in Javascript
● Streams
● Plugins
http://gulpjs.com
What is
Gulp?
End
Uses
Install
Plugins
Features
What it’s good for?
● Combine/Concatenate
● Preprocessing SASS/LESS
Coffeescript etc.
● Optimizing assets
● Tests
● Code changes triggered tasks
● others via plugins
What is
Gulp?
End
Uses
Install
Plugins
Features
---- install
> npm install -g gulp
> npm init
> npm install gulp --save-dev
----- configure
> nano gulpfile.js
----- run
> gulp
What is
Gulp?
End
Uses
Install
Plugins
Features
Tasks
gulp.task('js', function () {
...
});
gulp.task('css', function () {
...
});
gulp.task('server', function () {
...
pipe(livereload());//browser reload
});
gulp.task('default', function () {
Source and
Destination
webapp/
├── build
│ ├── images
│ ├── css
│ └── js
│ └── vendor
├── node_modules
│ ├── gulp
│ ├── gulp-concat
│ ├── gulp-html-replace
│ ├── gulp-notify
│ ├── gulp-uglify
│ └── gulp-uglifycss
├── src
│ ├── images
│ ├── css
│ └── js
│ └── vendor
├── package.json
// process js files save to build/js
gulp.task('js', function () {
return gulp.src('src/js/*.js')
.pipe(gulp.dest('build/js'));
});
Streams and
Pipe
Gulp: Task Runner
gulp.task('js', function () {
return gulp.src('js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(uglify())
.pipe(concat('app.js'))
.pipe(gulp.dest('build'));
});
Watch
gulp.task('setupJSWatch', function () {
gulp.watch('js/*.js', ['build']);
});
gulp.task('build', function () {
...
});
What is
Gulp?
End
Uses
Install
Plugins
Features
----- add plugins
> npm install gulp-[plugin] --save-dev
...
"devDependencies": { "gulp-concat": "^2.3.3",
"gulp-jshint": "^1.7.1",
"gulp-rename": "^1.2.0",
"gulp-sass": "^0.7.2",
"gulp-uglify": "^0.3.1" }
> npm install --save-dev gulp-concat
concat
var concat = require(‘gulp-concat’);
gulp.task('js', function () {
return gulp.src('js/*.js')
.pipe(concat('app.js'));
.pipe(gulp.dest('build'));
});
> npm install --save-dev gulp-uglify
uglify
var concat = require(‘gulp-uglify’);
gulp.task('js', function () {
return gulp.src('js/*.js')
.pipe(concat('app.js'));
.pipe(uglify());
.pipe(gulp.dest('build'));
});
> npm install --save-dev browser-sync
browsersync
var browserSync= require(‘browser-sync’);
gulp.task('js-watch', ['js'],browserSync.reload);
gulp.task('serve', ['js'], function () {
browserSync({
server: {
baseDir: "./src/"
},
port: 8080
});
// add browserSync.reload to the tasks array to make
// all browsers reload after tasks are complete.
gulp.watch("js/*.js", ['js-watch']);
});
imagemin
gulp-coffee/sass/less
livereload
gulp-util
compress/decompress
gulp-baseimg
other plugins
http://gulpjs.com/plugins/
What is
Gulp?
Wrap up
Uses
Install
Plugins
Features
● Gulp is a build system to automate
tedious, repetitive but very important
tasks
● Tasks/Streams
● Learn to use gulp.task, gulp.src,
gulp.dest and gulp.watch
● Explore plugins
Wrap up
http://gulpjs.com
● References
○ http://gulpjs.com
○ http://www.smashingmagazine.com/2014/06/11/bui
lding-with-gulp/
○ http://www.browsersync.io/docs/gulp/
○ https://www.npmjs.com/search?q=gulp
○ https://github.com/yeoman/generator-gulp-webapp
Gulp: Task Runner
NodeJS Fundamentals @ BCIT
chris@codespud.ca
@chrisbautista
The End

More Related Content

PPTX
Automated Development Workflow with Gulp
PDF
Gulp - The Streaming Build System
PDF
Intro to Gulp
PDF
Gulp: Your Build Process Will Thank You
PDF
Automating your workflow with Gulp.js
PDF
Improving your workflow with gulp
PPTX
Introduction to Gulp
PDF
Angular workflow with gulp.js
Automated Development Workflow with Gulp
Gulp - The Streaming Build System
Intro to Gulp
Gulp: Your Build Process Will Thank You
Automating your workflow with Gulp.js
Improving your workflow with gulp
Introduction to Gulp
Angular workflow with gulp.js

What's hot (20)

PDF
Frontend JS workflow - Gulp 4 and the like
PPTX
JavaScript Task Runners - Gulp & Grunt
PDF
Gulp - the streaming build system
PDF
Automating Large Applications on Modular and Structured Form with Gulp
PDF
Devenez le plus heureux des Front-end avec Gulp.js
ODP
GulpJs - An Introduction
PPTX
JavaScript code academy - introduction
PDF
Getting started with gulpjs
PPTX
Gulp and bower Implementation
PDF
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
PDF
60分鐘完送百萬edm,背後雲端ci/cd實戰大公開
PDF
Develop - Project Scaffolding
PDF
How we maintain 200+ Drupal sites in Georgetown University
ODP
Chef training Day4
PDF
How to integrate front end tool via gruntjs
ODP
Chef training Day5
PDF
The Secrets of The FullStack Ninja - Part A - Session I
ODP
Chef training - Day3
PDF
Web development tools { starter pack }
Frontend JS workflow - Gulp 4 and the like
JavaScript Task Runners - Gulp & Grunt
Gulp - the streaming build system
Automating Large Applications on Modular and Structured Form with Gulp
Devenez le plus heureux des Front-end avec Gulp.js
GulpJs - An Introduction
JavaScript code academy - introduction
Getting started with gulpjs
Gulp and bower Implementation
TDC2016SP - Esqueça Grunt ou Gulp. Webpack and NPM rule them all!
60分鐘完送百萬edm,背後雲端ci/cd實戰大公開
Develop - Project Scaffolding
How we maintain 200+ Drupal sites in Georgetown University
Chef training Day4
How to integrate front end tool via gruntjs
Chef training Day5
The Secrets of The FullStack Ninja - Part A - Session I
Chef training - Day3
Web development tools { starter pack }
Ad

Similar to Gulp: Task Runner (20)

PPTX
Take A Gulp at Task Automation
PPT
Npmgruntgulp
ODP
Introduction to GulpJs
PDF
Plumbin Pipelines - A Gulp.js workshop
PPTX
Getting Started with Gulp
PDF
Js Automation. npm scripts & Gulp
PDF
Building workflow in Javascript: Build the awesome with Gulp.
PDF
Building workflow in Javascript: Build the awesome with Gulp.
PPTX
Gulp js
PPTX
Make JavaScript Lean, Mean, and Clean
PDF
Time's Important - Let Task Management Save Yours
PDF
Quest for the Perfect Workflow for McrFRED
PPTX
NPM, Bower and Gulp Kickstart in Visual Studio
ODP
Laziness with Gulp
PPTX
JavaScript Build System Battle Royale | PrDC 2017
PDF
An introduction in to the world of front end automation - frontend ne (02 07-15)
PPTX
Word press workflows and gulp
PPTX
GulpGruntNPM
PDF
Javascript is your (Auto)mate
Take A Gulp at Task Automation
Npmgruntgulp
Introduction to GulpJs
Plumbin Pipelines - A Gulp.js workshop
Getting Started with Gulp
Js Automation. npm scripts & Gulp
Building workflow in Javascript: Build the awesome with Gulp.
Building workflow in Javascript: Build the awesome with Gulp.
Gulp js
Make JavaScript Lean, Mean, and Clean
Time's Important - Let Task Management Save Yours
Quest for the Perfect Workflow for McrFRED
NPM, Bower and Gulp Kickstart in Visual Studio
Laziness with Gulp
JavaScript Build System Battle Royale | PrDC 2017
An introduction in to the world of front end automation - frontend ne (02 07-15)
Word press workflows and gulp
GulpGruntNPM
Javascript is your (Auto)mate
Ad

Recently uploaded (20)

PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
1. Introduction to Computer Programming.pptx
PPTX
A Presentation on Touch Screen Technology
PDF
Enhancing emotion recognition model for a student engagement use case through...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Encapsulation theory and applications.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Getting Started with Data Integration: FME Form 101
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
Web App vs Mobile App What Should You Build First.pdf
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
1. Introduction to Computer Programming.pptx
A Presentation on Touch Screen Technology
Enhancing emotion recognition model for a student engagement use case through...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Encapsulation theory and applications.pdf
Encapsulation_ Review paper, used for researhc scholars
TLE Review Electricity (Electricity).pptx
Unlocking AI with Model Context Protocol (MCP)
Agricultural_Statistics_at_a_Glance_2022_0.pdf
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
DP Operators-handbook-extract for the Mautical Institute
Getting Started with Data Integration: FME Form 101
A novel scalable deep ensemble learning framework for big data classification...
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Zenith AI: Advanced Artificial Intelligence

Gulp: Task Runner

Editor's Notes

  • #2: Good evening. My name is Chris Bautista. My presentation is about Gulp task runner.
  • #4: Working as a developer, and I know you might identify with these, we tend to do a lot of other tasks building pages. These are just some of them. As a developer it’s second nature for us improve our workflow. That is where Gulp comes in.
  • #5: Is a build/automation system built with Javascript and Nodejs. It’s built around the concept of streams as opposed to files like Grunt. Gulp leverages a plugin system to create flexibility in configuring your automated workflows.
  • #7: Gulp is good for the automating any of the operations listed here and more. 8 sec
  • #9: Gulp installation is very straightforward You install gulp globally then install it as a development dependency for your projects To configure Gulp tasks, we create and modify gulpfile.js Once configured. Just run the gulp command to execute your tasks
  • #10: Gulp has features that we should be familiar with.
  • #12: Tasks are simply function definitions that contain the task you want to run. They can be used to work on simple tasks or more complex jobs. When you run > gulp without switches/parameters you are actually calling the default task.
  • #14: This is a typical web project structure. You have a src directory where you work, and a build folder where you put your optimized web application to be uploaded to a production server. Gulp enforces this practice
  • #15: You capture files from a source file or directory then you process it as a stream and save it as you’ve configured it in the dest method.
  • #16: First is streams
  • #17: Gulp operates on the concept of streams- to put it simply - streams carry the result of a previous operation and pipes/pushes it to another. This usually does not result in a physical file until the very end of the task. As illustrated here.
  • #18: this is a sample gulp file showing some common gulp operations. The stream is powered by the pipe method
  • #20: Watch is another feature of Gulp where you keep an eye/ watch changes on a source file or directory then trigger a predefined task
  • #22: Gulp’s magic is it numerouse plugins. A plugin is installed via a call in npm. Gulp plugins are always saved as a dev dependency.
  • #24: Concat plugin simply combines all source files into a stream. SImilar to the cat method in Unix
  • #25: Gulp-Uglify is a very common minification extension for gulp.
  • #26: This usually follows a concatenate operation
  • #27: Browsersync an excellent plugin used with gulp when testing your projects in browsers.
  • #28: Browser sync is particularly useful when testing your project on multiple screens. Code changes are immediately applied to the browsers without you going to each device and reloading it.
  • #29: There are other plugins you can use with gulp.
  • #31: Gulp is a very useful tool that improves the way we tackle our web projects. Next steps, try auditing your workflow now, see if you can automate and improve on certain tasks. then install and configure gulp to do these tasks for you. Explore the many plugins and techniques curated on the gulpjs website to get an idea.
  • #32: I added some URLs for some additional information.