SlideShare une entreprise Scribd logo
1  sur  20
/Fabien Doiron @fabien_doiron
WHAT'S INSIDE?
what is grunt
why use grunt
setup grunt dependencies
important commands
starting a new grunt project
grunt in action
FABIEN DOIRON?
Software Developer - Front End
 fabien-d fabien_doiron
WHAT IS GRUNT?
"cowboy" Ben Alman
(in other words: JavaScript task runner)
current stable version: 0.4.1
“task-based command line build tool for
JavaScript projects that makes performing
repetitive but necessary tasks trivial”
WHY USE GRUNT?
open source software
large community
ease of use
project sponsored by Bocoup
hundreds of plugins
or build your own
SETUP GRUNT DEPENDENCIES
INSTALL NODE + NPM
(I'd suggest looking at NVM)
www.nodejs.org
UNINSTALL GRUNT
if you've installed grunt globally in the past
npm uninstall -g grunt
INSTALL GRUNT CLI
(Command Line Interface)
does NOT install the grunt task runner
allows multiple version of grunt simultaneously
npm install -g grunt-cli
IMPORTANT GRUNT COMMANDS
installs all dev dependencies from package.json
'--save-dev' adds module to package.json as dev dependency
grunt modules are installed in 'node_modules/' directory
npm install
npm install {{PACKAGE_NAME}} --save-dev
grunt grunt {{TASK}}
grunt {{TASK}}:{{TARGET}}
STARTING A NEW GRUNT PROJECT
create 2 files
package.json Gruntfile.js
PACKAGE.JSON EXAMPLE
{
"name": "my-project",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.4.3"
}
}
GRUNTFILE.JS
easy as 1, 2, 3 ... 4*
1. install module
(terminal, project root directory)
2. load module
(Gruntfile.js)
npm install grunt-contrib-jshint --save-dev
grunt.loadNpmTasks('grunt-contrib-jshint');
3. configure task
(Gruntfile.js)
4. register task*
(Gruntfile.js) * register is optional
grunt.initConfig({
jshint: { ... }
});
grunt.registerTask('default', ['jshint']);
GRUNTFILE.JS EXAMPLE
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: { ... }
});
// Load the "jshint" task.
grunt.loadNpmTasks('grunt-contrib-jshint');
// Register task(s).
grunt.registerTask('default', ['jshint']);
};
GRUNT FOLDER STRUCTURE
node_modules/
grunt/
grunt-contrib-jshint/
Gruntfile.js
package.json
GRUNT IN ACTION
JS linting*
watch task*
JS minification
clean
JS testing (mocha/chai)
SASS -> CSS
dev tasks & prod tasks
replace scripts in HTML files
* build together
RESOURCES


nodejs.org
npmjs.org
gruntjs.com
gruntjs plugins
gruntjs stackoverflow
gruntjs
fabien-d
END

Contenu connexe

Tendances

DevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day DevelopmentDevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day Development
Rob Reynolds
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
twuniversity
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
abodeltae
 

Tendances (20)

Golang Microservices meetup
Golang Microservices meetupGolang Microservices meetup
Golang Microservices meetup
 
Annotation processing
Annotation processingAnnotation processing
Annotation processing
 
Seamless Continuous Deployment Using Docker Containers
Seamless Continuous Deployment Using Docker ContainersSeamless Continuous Deployment Using Docker Containers
Seamless Continuous Deployment Using Docker Containers
 
Frontend asset management with Bower and Gulp.js
Frontend asset management with Bower and Gulp.jsFrontend asset management with Bower and Gulp.js
Frontend asset management with Bower and Gulp.js
 
DevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day DevelopmentDevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day Development
 
OpenShift for developers in action! - jbcnconf19
OpenShift for developers in action! - jbcnconf19OpenShift for developers in action! - jbcnconf19
OpenShift for developers in action! - jbcnconf19
 
Ubuntu Opportunistic Programming (Europython 2011)
Ubuntu Opportunistic Programming (Europython 2011)Ubuntu Opportunistic Programming (Europython 2011)
Ubuntu Opportunistic Programming (Europython 2011)
 
How do I install virtual box?
How do I install virtual box?How do I install virtual box?
How do I install virtual box?
 
Git and GitFlow branching model
Git and GitFlow branching modelGit and GitFlow branching model
Git and GitFlow branching model
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
 
GitFlow Workshop
GitFlow WorkshopGitFlow Workshop
GitFlow Workshop
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
 
DevOps and Drupal
DevOps and DrupalDevOps and Drupal
DevOps and Drupal
 
Git flow workflow example
Git flow workflow exampleGit flow workflow example
Git flow workflow example
 
The State of Puppet - Dan Bode
The State of Puppet - Dan BodeThe State of Puppet - Dan Bode
The State of Puppet - Dan Bode
 
NLUUG Spring 2012 - OpenShift Primer
NLUUG Spring 2012 - OpenShift PrimerNLUUG Spring 2012 - OpenShift Primer
NLUUG Spring 2012 - OpenShift Primer
 
Odo improving the developer experience on OpenShift - hack & sangria
Odo   improving the developer experience on OpenShift - hack & sangriaOdo   improving the developer experience on OpenShift - hack & sangria
Odo improving the developer experience on OpenShift - hack & sangria
 
Embracing the Change: How to Win with Gutenberg
Embracing the Change: How to Win with GutenbergEmbracing the Change: How to Win with Gutenberg
Embracing the Change: How to Win with Gutenberg
 
Git workflows
Git workflowsGit workflows
Git workflows
 
A-Team-Vipul
A-Team-VipulA-Team-Vipul
A-Team-Vipul
 

Similaire à Grunt Talk Given at Ottawa JS

Docker on Google App Engine
Docker on Google App EngineDocker on Google App Engine
Docker on Google App Engine
Docker, Inc.
 
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
Philipp Burgmer
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Simon Boulet
 

Similaire à Grunt Talk Given at Ottawa JS (20)

Drupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflowDrupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflow
 
Grunt - The JavaScript Task Runner
Grunt - The JavaScript Task RunnerGrunt - The JavaScript Task Runner
Grunt - The JavaScript Task Runner
 
Drone CI
Drone CIDrone CI
Drone CI
 
Lando - AddWeb Solution
Lando - AddWeb Solution Lando - AddWeb Solution
Lando - AddWeb Solution
 
Composer
ComposerComposer
Composer
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
Frontend Build Tools - CC FE & UX
Frontend Build Tools - CC FE & UXFrontend Build Tools - CC FE & UX
Frontend Build Tools - CC FE & UX
 
Front end workflow with yeoman
Front end workflow with yeomanFront end workflow with yeoman
Front end workflow with yeoman
 
Prizm Installation Guide
Prizm Installation GuidePrizm Installation Guide
Prizm Installation Guide
 
Voiture tech talk
Voiture tech talkVoiture tech talk
Voiture tech talk
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
Flatpak
FlatpakFlatpak
Flatpak
 
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
2014-08-19 Multiple Approaches to Managing Puppet Modules @ Puppet Camp Chicago
 
Continuous delivery with docker
Continuous delivery with dockerContinuous delivery with docker
Continuous delivery with docker
 
Docker on Google App Engine
Docker on Google App EngineDocker on Google App Engine
Docker on Google App Engine
 
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
 
Grunt
GruntGrunt
Grunt
 
Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!Multi-stage Docker builds to make building easy!
Multi-stage Docker builds to make building easy!
 
Install MariaDB on IBM i - Tips, troubleshooting, and more
Install MariaDB on IBM i - Tips, troubleshooting, and moreInstall MariaDB on IBM i - Tips, troubleshooting, and more
Install MariaDB on IBM i - Tips, troubleshooting, and more
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Dernier (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

Grunt Talk Given at Ottawa JS