SlideShare a Scribd company logo
What grunt?
An introduction to Front end compilation
Specialization
●More devices
●More software
●More specialization
Web Dev
●Back end – front end
●Optimization in both sides
●Large process broken into pieces
●Dependencies handled separately
FrontEnd compile
●Assets are minimized
●Files are concatenated
●Less requests
●Static page size reduced
Bower
●Manage source code dependencies
●Jquery, Angular, etc
●Dependencies listed in bower.json
●Common folder: bower_components
●Each app has its bower config
Grunt
●Manage compile tasks
●Usually every task is a plugin
●Plugins are grunt dependencies
●Dependencies are in package.json
●Common folder: node_modules
●Several apps can share grunt configs
Grunt in action
●Several tiny tasks
●Single responsibility principle
●Automate repetitive tasks
●Separate prod from dev
Modules
●Setup configs
●Export configs
●The final task is a node
module
Grunt config
●Define grunt final tasks
●Where grunt modules
are used
Grunt config
Initial Config vs Merge
Set once vs prepend
Custom tasks definition
●Group several tasks into
one
●More explicit to user
Custom tasks definition
Task renaming
●Extend support for tasks
without targets
Development tasks
●Automatization
●Console debug
●Fast browser refresh
JSHint task
●Inspired in JS lint
●Verify syntax of javascript
source code
●Search for warning and
errors
Include source task
●Inject several files
references into code
●No forget about new files
●Anyt type of file, js, less
Include source task
Source:
index.html.template
Include source task
Result: Index.html
Wiredep task
●Smart injection of bower
dependencies, js and
css
Wiredep task
Source:
index.html.template
Wiredep task
Result: Index.html
Less task
●Compile less into CSS
●A main less file with
@imports
●Only 1 css file as output
Ng templates task
●Compiles all the HTML
into a JS file
●Usage of
$templateCache
Watch task
●Observe files
●Execute an action after
modifications noticed
●Don't need to re-run tasks
manually
BrowserSync task
●Proxy the server
●Use an unique instance through
different devices
●Inject source code live in browser
after changes (live reload)
Production tasks
●Optimization of
everything
●Output is what user will
get
Ng templates task
●Same as before and:
●Optimization by reducing
●Whitespaces
●Unneded attributes, etc
Less task
●Same as before
●Yep, not even
optimization
UseminPrepare task
●Specifies list of files to
concatenates
●Reading index.html
●Further tasks can process
one file instead of a few
UseminPrepare task
●Files inside comment
concatenates in one file
Concat task
●Actually concatenates
the files specified by
useminPrepare task
Uglify task
●Remove unnecessary
JS code
●Warning for security with
compiler bugs
PostCSS task
●PostCSS is the new black
●My fav post processors:
minify css and
autoprefixers
Copy task
●Copy other files to the
prod directory
●Usually, they aren't
optimized yet
Usemin task
●Replace references in
index.html to optimized
version
●Runs after optimized files
are in prod directory
Imagemin task
●Optimize images
●Output is saved in prod directory
●Usually metadata is removed
●Not all the images are optimized but
all are moved
Htmlmin task
●Optimize the final
index.html
●Templates were already
optimized in the js
Attributions
Thanks to Scott Rippey!
End.
Lucio Martinez
GitHub project:
https://github.com/lucio-martinez/what-grunt

More Related Content

PPTX
Grunt - The JavaScript Task Runner
PDF
Grunt JS - Getting Started With Grunt
PPTX
Grunt to automate JS build
PDF
Front-end development automation with Grunt
PDF
Preprocessor Workflow with Grunt
PDF
Grunt js and WordPress
PDF
Production Ready Javascript With Grunt
PDF
Introduction to Express and Grunt
Grunt - The JavaScript Task Runner
Grunt JS - Getting Started With Grunt
Grunt to automate JS build
Front-end development automation with Grunt
Preprocessor Workflow with Grunt
Grunt js and WordPress
Production Ready Javascript With Grunt
Introduction to Express and Grunt

What's hot (20)

PPTX
PDF
Modernizing Your WordPress Workflow with Grunt & Bower
PPTX
Grunt understanding
PPTX
Modern Development Tools
PDF
Automate your WordPress Workflow with Grunt.js
PDF
Grunt training deck
PDF
Angular workflow with gulp.js
PDF
Daniel Steigerwald: EsteJS - javascriptové aplikace robusně, modulárně a komf...
PPTX
Dial up your flow
PDF
GDG Kraków - Intro to front-end automation using bower.js & grunt.js
PDF
Bower & Grunt - A practical workflow
PDF
TDC2018SP | Trilha Containers - CI/CD com Docker e Drone
PDF
Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!
PPTX
Grunt Continuous Development of the Front End Tier
PDF
Gulp - The Streaming Build System
PDF
Daniel Steigerwald - Este.js - konec velkého Schizma
PDF
Improving your workflow with gulp
PDF
Intro to Gulp
PPTX
Docker session I: Continuous integration, delivery and deployment
Modernizing Your WordPress Workflow with Grunt & Bower
Grunt understanding
Modern Development Tools
Automate your WordPress Workflow with Grunt.js
Grunt training deck
Angular workflow with gulp.js
Daniel Steigerwald: EsteJS - javascriptové aplikace robusně, modulárně a komf...
Dial up your flow
GDG Kraków - Intro to front-end automation using bower.js & grunt.js
Bower & Grunt - A practical workflow
TDC2018SP | Trilha Containers - CI/CD com Docker e Drone
Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!
Grunt Continuous Development of the Front End Tier
Gulp - The Streaming Build System
Daniel Steigerwald - Este.js - konec velkého Schizma
Improving your workflow with gulp
Intro to Gulp
Docker session I: Continuous integration, delivery and deployment
Ad

Similar to What grunt? (20)

PPTX
Mono Repo
PDF
Gradle
PDF
Gradle build automation tool
ODP
Continuous delivery of Windows micro services in the cloud
PPTX
Node js for beginners
PDF
The Accidental DBA
ODP
Maven in Java EE project
PDF
Go Pro, Inc. Case Study: Dive into the details of our node.js applications
PDF
GeoServer Developers Workshop
PDF
JenkinsCI
PDF
PyConFR 2014 - DEPOT, Story of a file.write() gone wrong
PDF
Electron JS | Build cross-platform desktop applications with web technologies
PDF
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
PDF
Gradle - the Enterprise Automation Tool
PDF
Spark and S3 with Ryan Blue
PDF
Architektura html, css i javascript - Jan Kraus
PPTX
Adding a GUI to Go
PDF
Tech meetup: Web Applications Performance
PPTX
The Professional Programmer
PPTX
How I Built My Code Editor in Ruby
Mono Repo
Gradle
Gradle build automation tool
Continuous delivery of Windows micro services in the cloud
Node js for beginners
The Accidental DBA
Maven in Java EE project
Go Pro, Inc. Case Study: Dive into the details of our node.js applications
GeoServer Developers Workshop
JenkinsCI
PyConFR 2014 - DEPOT, Story of a file.write() gone wrong
Electron JS | Build cross-platform desktop applications with web technologies
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
Gradle - the Enterprise Automation Tool
Spark and S3 with Ryan Blue
Architektura html, css i javascript - Jan Kraus
Adding a GUI to Go
Tech meetup: Web Applications Performance
The Professional Programmer
How I Built My Code Editor in Ruby
Ad

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation theory and applications.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Empathic Computing: Creating Shared Understanding
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation theory and applications.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Network Security Unit 5.pdf for BCA BBA.
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Dropbox Q2 2025 Financial Results & Investor Presentation
Digital-Transformation-Roadmap-for-Companies.pptx
Spectral efficient network and resource selection model in 5G networks
Encapsulation_ Review paper, used for researhc scholars
Empathic Computing: Creating Shared Understanding
Review of recent advances in non-invasive hemoglobin estimation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
“AI and Expert System Decision Support & Business Intelligence Systems”

What grunt?