SlideShare a Scribd company logo
JavaScript Build Automation
Scripts & Task Runners
• In General: Why, What, How?
• Automation with NPM Scripts
• Automation with Task Runners (Gulp)
JavaScript Build Automation
Build automation is the process of automating the
creation of a software build and the associated
processes including: compiling computer source code into
binary code, packaging binary code, and running
automated tests.
— Wikipedia
Why?
Not Waste Time for the Same
Process
Example: Preparing HTML/CSS/JS for
Production
• JS Compilation (TS || ES6 -> ES5)
• Minify
• Concat
• Styles Compilation (Sass || Less -> Css)
• Css Vendor Prefixes && Optimization
• Separately Handling Vendor and Custom Code
• Auto Injecting Files into HTML
• Running Tests
• Push to Production
• …
Example: Awesome Development
Environment
• Browser Live Reloading, File Watching
• JS Compilation
• Styles Compilation
• Linting
• Running Tests
• HTML Injection
Automate Tasks
Code Quality Tests Build Pipeline
What’s in It for You?
Improve Quality Deliver Faster
Repeatable
and Consistent
Automated Build Pipeline
Develop -> Analyze -> Test -> Build -> Deploy
Work Smarter, Not Harder
Automation with NPM Scripts
{
"name": "npm-scripts-tests",
"version": "1.0.0",
"scripts": {
"start": "node server.js",
"build": "tsc --out app.js"
},
"devDependencies": {
...
}
}
Automation with NPM Scripts
{
"name": "npm-scripts-tests",
"version": "1.0.1",
"scripts": {
"build:prod:libs": "bowcat libs.js && uglifyjs lib.js --compress --
mangle --output lib.js",
"build:prod:app": "tsc --out app.js && uglifyjs app.js --compress --
mangle --output app.js",
"build:prod:css": "node-sass src/styles/app.scss --recursive --output-
style compressed --output app.css",
"build:prod": "parallelshell "npm run build:prod:libs" "npm run
build:prod:app" "npm run build:prod:css"",
"build:dev:libs": "bowcat libs.js",
"build:dev:app": "tsc --out app.js",
"build:dev:css": "node-sass src/styles/app.scss --recursive --output-
style compressed --output app.css",
"build:dev": "parallelshell "npm run build:dev:libs" "npm run
build:dev:app" "npm run build:dev:css""
},
"devDependencies": {
...
}
}
Demo
Automation with NPM Scripts
• Build Steps as Shell Commands
• Don't Have the Complexity of a Full Build Tool.
• No Need to Install an Additional Command-line
Tool to Run Your Build.
Automation with Task Runners
http://gruntjs.comhttp://gulpjs.com
Gulp vs Grunt
• Code over Configuration
• More Compact Config
• VFS: No Temp Folders
• Streams Parallelism
Automation with Task Runners
• The Full Power of Node and JavaScript
• Consistent APIs Optimized for Composing Build
Tasks
• Huge Ecosystems of Plugins
• Avoid Cross-platform Compatibility Problems
Typical Gulp Task
File System -> Read Files -> Modify -> Modify ->
-> Modify -> Write Files -> Dest
Gulpfile.js
gulp.task('js', function() {

return gulp

.src('**/*.js')

.pipe($.eslint())

.pipe($.concat())

.pipe($.uglify())
.pipe(gulp.dest('./build/'))

})
Demo
Useful Links: NPM Scripts vs Task
Runners
	 •	 Build Tools vs npm Scripts: Why Not Both?

	 •	 Give Grunt the Boot! A Guide to Using npm as a Build Tool

	 •	 How to Use npm as a Build Tool

	 •	 Task Automation with npm Run

	 •	 Using npm as a Build System for Your next Project
Useful Resources to Learn
• 	 Whole Picture [read]

• 	 learn.javascript.ru Screen Cast Gulp [watch]

•	 Getting Started with Gulp [read][$]

•	 Gulp Basics [watch][$]

•	 JavaScript Build Automation With Gulp.js [watch][$]

•	 Learning Gulp - Getting Started with the Front End Factory [read]

•	 Rapid Gulp [watch][$]

•	 Using npm as a Task Runner [watch][$]

More Related Content

PPTX
Building a Continuous Delivery Pipeline With Visual Studio
PPTX
Building Custom Visual Studio Team Service Build Tasks With VSTS DevOps Task SDK
PDF
Sandstone HPC: A Domain General Gateway for New Users
PDF
Modern infrastructure as code with ansible cake fest 2021
PDF
Gulp and Compass
KEY
CoffeeScript in hootsuite
PDF
Webpack & React Performance in 16+ Steps
PDF
WordCamp IL 2016 - WordPress Scale on AWS
Building a Continuous Delivery Pipeline With Visual Studio
Building Custom Visual Studio Team Service Build Tasks With VSTS DevOps Task SDK
Sandstone HPC: A Domain General Gateway for New Users
Modern infrastructure as code with ansible cake fest 2021
Gulp and Compass
CoffeeScript in hootsuite
Webpack & React Performance in 16+ Steps
WordCamp IL 2016 - WordPress Scale on AWS

What's hot (20)

PPTX
Tc open-doors-day-speech
PPTX
goployer, 코드 기반의 배포 도구 - 송주영 (beNX) :: AWS Community Day 2020
PPTX
JavaScript Task Runners - Gulp & Grunt
PDF
Slim PHP when you don't need the kitchen sink
PPTX
Dev ops for mobile apps at microsoft teams
PDF
The future of cloud programming
PDF
JSFoo-2017 Takeaways
PPT
Coffee script final
PPTX
Infrastructure as Code
PDF
Build App with Nodejs - YWC Workshop
PPTX
Anton Boyko, "The evolution of microservices platform or marketing gibberish"
PDF
Anton Boyko "The future of serverless computing"
PDF
Angular workflow with gulp.js
PPTX
Ci of js and apex using jasmine, phantom js and drone io df14
PPTX
CLI utility in ClojureScript running on Node.js
PDF
Scaling WordPress - WP on AWS
PDF
Cucumber.js: Cuke up your JavaScript!
PDF
Azure Functions - the evolution of microservices platform or marketing gibber...
PPTX
Azue Webjobs
PPT
Big Data DC - BenchPress
Tc open-doors-day-speech
goployer, 코드 기반의 배포 도구 - 송주영 (beNX) :: AWS Community Day 2020
JavaScript Task Runners - Gulp & Grunt
Slim PHP when you don't need the kitchen sink
Dev ops for mobile apps at microsoft teams
The future of cloud programming
JSFoo-2017 Takeaways
Coffee script final
Infrastructure as Code
Build App with Nodejs - YWC Workshop
Anton Boyko, "The evolution of microservices platform or marketing gibberish"
Anton Boyko "The future of serverless computing"
Angular workflow with gulp.js
Ci of js and apex using jasmine, phantom js and drone io df14
CLI utility in ClojureScript running on Node.js
Scaling WordPress - WP on AWS
Cucumber.js: Cuke up your JavaScript!
Azure Functions - the evolution of microservices platform or marketing gibber...
Azue Webjobs
Big Data DC - BenchPress
Ad

Viewers also liked (18)

KEY
Single Page Applications - Desert Code Camp 2012
PDF
The rise of single-page applications
PDF
Front End Development Automation with Grunt
PDF
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
PDF
An introduction in to the world of front end automation - frontend ne (02 07-15)
PPTX
Single page applications
PPTX
Making Single Page Applications (SPA) faster
PDF
The Dark Side of Single Page Applications
PDF
Single page applications
PPTX
Front-end development introduction (JavaScript). Part 2
PDF
Npm scripts
PDF
Single page application
PDF
Single Page Applications
PDF
Measuring the Performance of Single Page Applications
PPTX
Building single page applications
PDF
Introduction To Single Page Application
PPTX
Single Page Application (SPA) using AngularJS
PPTX
40+ tips to use Postman more efficiently
Single Page Applications - Desert Code Camp 2012
The rise of single-page applications
Front End Development Automation with Grunt
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
An introduction in to the world of front end automation - frontend ne (02 07-15)
Single page applications
Making Single Page Applications (SPA) faster
The Dark Side of Single Page Applications
Single page applications
Front-end development introduction (JavaScript). Part 2
Npm scripts
Single page application
Single Page Applications
Measuring the Performance of Single Page Applications
Building single page applications
Introduction To Single Page Application
Single Page Application (SPA) using AngularJS
40+ tips to use Postman more efficiently
Ad

Similar to Js Automation. npm scripts & Gulp (20)

PPTX
Java script nirvana in netbeans [con5679]
PDF
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
PPTX
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
PPTX
Node.js Development with Apache NetBeans
PDF
The MEAN Stack
PDF
Aws-What You Need to Know_Simon Elisha
PPTX
Grunt Continuous Development of the Front End Tier
PDF
Automated Deployment and Configuration Engines. Ansible
PPTX
Devops
PPTX
Beginners Node.js
PDF
Build automation best practices
PPTX
Silicon Valley JUG - How to generate customized java 8 code from your database
PPTX
How to generate customized java 8 code from your database
PPT
Front-End Tools and Workflows
PPTX
Breaking the eggshell: From .NET to Node.js
PDF
Working in Harmony: Manchester - Optimize development and content workflows
PDF
Node.js Development Workflow Automation with Grunt.js
PPTX
Groovy & Grails - From Scratch to Production
PPTX
A tale in automation (Puppet to Ansible)
Java script nirvana in netbeans [con5679]
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Node.js Development with Apache NetBeans
The MEAN Stack
Aws-What You Need to Know_Simon Elisha
Grunt Continuous Development of the Front End Tier
Automated Deployment and Configuration Engines. Ansible
Devops
Beginners Node.js
Build automation best practices
Silicon Valley JUG - How to generate customized java 8 code from your database
How to generate customized java 8 code from your database
Front-End Tools and Workflows
Breaking the eggshell: From .NET to Node.js
Working in Harmony: Manchester - Optimize development and content workflows
Node.js Development Workflow Automation with Grunt.js
Groovy & Grails - From Scratch to Production
A tale in automation (Puppet to Ansible)

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Cloud computing and distributed systems.
PDF
Approach and Philosophy of On baking technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
cuic standard and advanced reporting.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
KodekX | Application Modernization Development
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Machine learning based COVID-19 study performance prediction
20250228 LYD VKU AI Blended-Learning.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Cloud computing and distributed systems.
Approach and Philosophy of On baking technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Review of recent advances in non-invasive hemoglobin estimation
cuic standard and advanced reporting.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Understanding_Digital_Forensics_Presentation.pptx
Empathic Computing: Creating Shared Understanding
KodekX | Application Modernization Development
MIND Revenue Release Quarter 2 2025 Press Release
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25 Week I
“AI and Expert System Decision Support & Business Intelligence Systems”
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Machine learning based COVID-19 study performance prediction

Js Automation. npm scripts & Gulp

  • 2. • In General: Why, What, How? • Automation with NPM Scripts • Automation with Task Runners (Gulp) JavaScript Build Automation
  • 3. Build automation is the process of automating the creation of a software build and the associated processes including: compiling computer source code into binary code, packaging binary code, and running automated tests. — Wikipedia
  • 5. Not Waste Time for the Same Process
  • 6. Example: Preparing HTML/CSS/JS for Production • JS Compilation (TS || ES6 -> ES5) • Minify • Concat • Styles Compilation (Sass || Less -> Css) • Css Vendor Prefixes && Optimization • Separately Handling Vendor and Custom Code • Auto Injecting Files into HTML • Running Tests • Push to Production • …
  • 7. Example: Awesome Development Environment • Browser Live Reloading, File Watching • JS Compilation • Styles Compilation • Linting • Running Tests • HTML Injection
  • 8. Automate Tasks Code Quality Tests Build Pipeline
  • 9. What’s in It for You? Improve Quality Deliver Faster Repeatable and Consistent
  • 10. Automated Build Pipeline Develop -> Analyze -> Test -> Build -> Deploy
  • 12. Automation with NPM Scripts { "name": "npm-scripts-tests", "version": "1.0.0", "scripts": { "start": "node server.js", "build": "tsc --out app.js" }, "devDependencies": { ... } }
  • 13. Automation with NPM Scripts { "name": "npm-scripts-tests", "version": "1.0.1", "scripts": { "build:prod:libs": "bowcat libs.js && uglifyjs lib.js --compress -- mangle --output lib.js", "build:prod:app": "tsc --out app.js && uglifyjs app.js --compress -- mangle --output app.js", "build:prod:css": "node-sass src/styles/app.scss --recursive --output- style compressed --output app.css", "build:prod": "parallelshell "npm run build:prod:libs" "npm run build:prod:app" "npm run build:prod:css"", "build:dev:libs": "bowcat libs.js", "build:dev:app": "tsc --out app.js", "build:dev:css": "node-sass src/styles/app.scss --recursive --output- style compressed --output app.css", "build:dev": "parallelshell "npm run build:dev:libs" "npm run build:dev:app" "npm run build:dev:css"" }, "devDependencies": { ... } }
  • 14. Demo
  • 15. Automation with NPM Scripts • Build Steps as Shell Commands • Don't Have the Complexity of a Full Build Tool. • No Need to Install an Additional Command-line Tool to Run Your Build.
  • 16. Automation with Task Runners http://gruntjs.comhttp://gulpjs.com
  • 17. Gulp vs Grunt • Code over Configuration • More Compact Config • VFS: No Temp Folders • Streams Parallelism
  • 18. Automation with Task Runners • The Full Power of Node and JavaScript • Consistent APIs Optimized for Composing Build Tasks • Huge Ecosystems of Plugins • Avoid Cross-platform Compatibility Problems
  • 19. Typical Gulp Task File System -> Read Files -> Modify -> Modify -> -> Modify -> Write Files -> Dest
  • 20. Gulpfile.js gulp.task('js', function() {
 return gulp
 .src('**/*.js')
 .pipe($.eslint())
 .pipe($.concat())
 .pipe($.uglify()) .pipe(gulp.dest('./build/'))
 })
  • 21. Demo
  • 22. Useful Links: NPM Scripts vs Task Runners • Build Tools vs npm Scripts: Why Not Both? • Give Grunt the Boot! A Guide to Using npm as a Build Tool • How to Use npm as a Build Tool • Task Automation with npm Run • Using npm as a Build System for Your next Project
  • 23. Useful Resources to Learn • Whole Picture [read] • learn.javascript.ru Screen Cast Gulp [watch] • Getting Started with Gulp [read][$] • Gulp Basics [watch][$] • JavaScript Build Automation With Gulp.js [watch][$] • Learning Gulp - Getting Started with the Front End Factory [read] • Rapid Gulp [watch][$] • Using npm as a Task Runner [watch][$]