SlideShare a Scribd company logo
Automate All the Things
with Grunt
Sheelah Brennan http://sheelahb.com2
About Me
@sheelah_b
http://sheelahb.com
2
Sheelah Brennan http://sheelahb.com3
What is Grunt?
Sheelah Brennan http://sheelahb.com4
• Compile Sass or Less into CSS
• Automatically reload content after changes to
CSS, JavaScript, HTML, or other assets
• Lint, concatenate, and compress JavaScript files
• Optimize images and SVG files
• Automate performance testing
What can it do?
Sheelah Brennan http://sheelahb.com5
• Install Node.js (https://nodejs.org/)
• Install Grunt CLI (npm install -g grunt-cli)
Grunt Prerequisites
Sheelah Brennan http://sheelahb.com6
• Generate a package.json file (npm init)
• Install Grunt in your project (npm install
grunt --save-dev)
• Barebones Gruntfile.js
Grunt Setup within Project
Sheelah Brennan http://sheelahb.com7
• Grunt watch plugin (npm install grunt-
contrib-watch --save-dev)
• Grunt libsass plugin (npm install grunt-sass
--save-dev)
Starter Grunt Plugins
Sheelah Brennan http://sheelahb.com8
• Enable source map generation to be able to view Sass/
Less source files in the browser

















http://www.sitepoint.com/using-source-maps-debug-
sass-chrome/

#quicktip
Sheelah Brennan http://sheelahb.com9
BrowserSync Plugin
Sheelah Brennan http://sheelahb.com10
• Synchronized cross-device and cross-browser
testing FTW



npm install grunt-browser-sync --save-
dev



http://www.browsersync.io/
BrowserSync Plugin
Sheelah Brennan http://sheelahb.com11
• Automatically adds vendor prefixes where
needed in your CSS



npm install grunt-postcss autoprefixer
--save-dev
Autoprefixer Plugin
Sheelah Brennan http://sheelahb.com12
• No need to manually include loadNpmTasks
entries for each task (npm install load-
grunt-tasks --save-dev)
• Get time metrics for each task (npm install
--save-dev time-grunt)
Automatically Load Tasks
Sheelah Brennan http://sheelahb.com13
• JSHint (http://jshint.com/)



npm install grunt-contrib-jshint 

--save-dev



npm install jshint-stylish --save-dev
JavaScript-Related Plugins
Sheelah Brennan http://sheelahb.com14
• Concat

npm install grunt-contrib-concat

--save-dev

• Uglify

npm install grunt-contrib-uglify

--save-dev
JavaScript-Related Plugins
Sheelah Brennan http://sheelahb.com15
• Imagemin



npm install grunt-contrib-imagemin

--save-dev
Image Optimization Plugin
Sheelah Brennan http://sheelahb.com16
• CSS optimizations (grunt-criticalcss)

https://github.com/addyosmani/critical-path-css-
tools
• Performance testing (grunt-perfbudget) using
WebPageTest.org

http://www.sitepoint.com/automate-
performance-testing-grunt-js/
Taking it up a Level
Sheelah Brennan http://sheelahb.com17
• Unit testing (Ex. grunt-contrib-jasmine)
• Internationalization and localization
Taking it up a Level
Sheelah Brennan http://sheelahb.com18
• Pull down the git repo
• Install the required Grunt plugins (npm install)
Contributing to an Existing
Project Using Grunt
Sheelah Brennan http://sheelahb.com19
• Gulp (http://gulpjs.com/)
• CodeKit (Gui, Mac only)
• Prepros (Gui, Windows only)
Grunt Alternatives
Sheelah Brennan http://sheelahb.com20
• https://css-tricks.com/grunt-people-think-things-
like-grunt-weird-hard/
• https://scotch.io/tutorials/a-simple-guide-to-
getting-started-with-grunt/
• http://gruntjs.com/getting-started/
References
Sheelah Brennan http://sheelahb.com
@sheelah_b
21
Questions?

More Related Content

PDF
Advanced front-end automation with npm scripts
PDF
How to make your Webpack builds 10x faster
PDF
Production optimization with React and Webpack
PPTX
WordPress + NGINX Best Practices with EasyEngine
PDF
Production Ready Javascript With Grunt
PDF
Jaap : node, npm & grunt
PPTX
Getting started with node.js
PDF
npm + browserify
Advanced front-end automation with npm scripts
How to make your Webpack builds 10x faster
Production optimization with React and Webpack
WordPress + NGINX Best Practices with EasyEngine
Production Ready Javascript With Grunt
Jaap : node, npm & grunt
Getting started with node.js
npm + browserify

What's hot (20)

PDF
Preprocessor Workflow with Grunt
PDF
Front-end development automation with Grunt
PDF
Modernizing Your WordPress Workflow with Grunt & Bower
PDF
Node.js in a heterogeneous system
PDF
Bower & Grunt - A practical workflow
PPTX
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
PDF
Capybara with Rspec
PPTX
Performance Metrics in a Day with Selenium
PDF
Madison PHP 2015 - DevOps For Small Teams
PPTX
how to mesure web performance metrics
PDF
Single page apps with drupal 7
PPT
Continuous Integration
PDF
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
PPTX
Word press workflows and gulp
PPTX
Capybara + RSpec - ruby dsl-based web ui qa automation
PPTX
Using the Command Line: Bash and WP-CLI
PPTX
Modern web technologies
PDF
ReactJS Workflows
PPTX
DotNet MVC and webpack + Babel + react
PDF
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
Preprocessor Workflow with Grunt
Front-end development automation with Grunt
Modernizing Your WordPress Workflow with Grunt & Bower
Node.js in a heterogeneous system
Bower & Grunt - A practical workflow
2015 TechSummit Web & Cloud - Gem, NPM, Bower, Nuget, Paket - Päckchen hier, ...
Capybara with Rspec
Performance Metrics in a Day with Selenium
Madison PHP 2015 - DevOps For Small Teams
how to mesure web performance metrics
Single page apps with drupal 7
Continuous Integration
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
Word press workflows and gulp
Capybara + RSpec - ruby dsl-based web ui qa automation
Using the Command Line: Bash and WP-CLI
Modern web technologies
ReactJS Workflows
DotNet MVC and webpack + Babel + react
Service Delivery Assembly Line with Vagrant, Packer, and Ansible
Ad

Viewers also liked (20)

DOCX
Chhattisgarh State Budget 2016 on Social Media
DOCX
Project_Paper_ISSC455_Intindolo
DOCX
Full essay
PPT
науково практична конференція
PPTX
Agility in 2016
PPTX
Casas susten
PDF
Nimlok Brochure 2015 FINAL digital
PPTX
Penal 310316
PDF
Feature toggling
PPTX
The cleverest
PPTX
Earth infrastructure complaints no more a concern now
PPTX
Reality against Earth Infrastructure Complaints
PPT
Артеменко В.Б. (ITEA-2011)
PDF
2014 oecd economic survey of canada
PPTX
Diagnostic by-fancisco-rodriguez
PDF
Folleto Colección Terra - Ariane_sept_2016
PPSX
Steady Groundwater Flow Simulation towards Ains in a Heterogeneous Subsurface
DOCX
ACC 491 Week 4 Learning Team Assignment Apollo Shoes Case Assignment (1) 2015...
DOC
essay 2 - EDITED
PDF
Teenage Driving
Chhattisgarh State Budget 2016 on Social Media
Project_Paper_ISSC455_Intindolo
Full essay
науково практична конференція
Agility in 2016
Casas susten
Nimlok Brochure 2015 FINAL digital
Penal 310316
Feature toggling
The cleverest
Earth infrastructure complaints no more a concern now
Reality against Earth Infrastructure Complaints
Артеменко В.Б. (ITEA-2011)
2014 oecd economic survey of canada
Diagnostic by-fancisco-rodriguez
Folleto Colección Terra - Ariane_sept_2016
Steady Groundwater Flow Simulation towards Ains in a Heterogeneous Subsurface
ACC 491 Week 4 Learning Team Assignment Apollo Shoes Case Assignment (1) 2015...
essay 2 - EDITED
Teenage Driving
Ad

Similar to Automate All the Things with Grunt (20)

PDF
Front End Development Automation with Grunt
PDF
Quest for the Perfect Workflow for McrFRED
PDF
Grunt All Day
PDF
Grunt training deck
PDF
What makes me "Grunt"?
PPTX
Introducing grunt, npm and sass
PPTX
Frontend Workflow
PDF
Grunt & Front-end Workflow
PPTX
Modern Development Tools
PDF
Javascript is your (Auto)mate
PDF
Building your own personal minion with grunt.js
PDF
Intro to grunt
PPTX
Grunt - The JavaScript Task Runner
PDF
Grunt: the wild boar dev's best friend - WordCamp London 2018
PPTX
PPTX
Grunt understanding
PDF
Resource Registries: Plone Conference 2014
PPTX
Grunt to automate JS build
PDF
Resource registries plone conf 2014
PDF
GruntJS
Front End Development Automation with Grunt
Quest for the Perfect Workflow for McrFRED
Grunt All Day
Grunt training deck
What makes me "Grunt"?
Introducing grunt, npm and sass
Frontend Workflow
Grunt & Front-end Workflow
Modern Development Tools
Javascript is your (Auto)mate
Building your own personal minion with grunt.js
Intro to grunt
Grunt - The JavaScript Task Runner
Grunt: the wild boar dev's best friend - WordCamp London 2018
Grunt understanding
Resource Registries: Plone Conference 2014
Grunt to automate JS build
Resource registries plone conf 2014
GruntJS

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Approach and Philosophy of On baking technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Getting Started with Data Integration: FME Form 101
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation_ Review paper, used for researhc scholars
MIND Revenue Release Quarter 2 2025 Press Release
MYSQL Presentation for SQL database connectivity
Group 1 Presentation -Planning and Decision Making .pptx
Approach and Philosophy of On baking technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Electronic commerce courselecture one. Pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectroscopy.pptx food analysis technology
Network Security Unit 5.pdf for BCA BBA.
Getting Started with Data Integration: FME Form 101
Dropbox Q2 2025 Financial Results & Investor Presentation

Automate All the Things with Grunt