SlideShare a Scribd company logo
Grunt.js
The build tool for the web
for the web-experience



                             david.amend@it-amend.de
https://github.com/raDiesle/backbone.js-jquerymobile-boilerplate-template
Technical Background
Content

●   Why a build tool is needed for CI ?
●   Why Grunt.js ?
●   Demo
●   Why Yeoman perfects Grunt.js
Supports Development
Continuous integration
aims to improve the quality of software,
and to reduce the time taken to deliver it,
by replacing the traditional practice of
applying quality control   after completing all
development.
The process of
Continous Integration


Developer


            Code


                   CI-Server
The process of
 Continous Integration
                                                Cloud

                   Webserver
                                Developer


Developer
                                            Business/
                                            -Customer
            Code


                    CI-Server

                                      QA-Employee
The process of
 Continous Integration
                                                Cloud

                   Webserver
                                Developer


Developer
                                            Business/
                                            -Customer
            Code


                    CI-Server

                                      QA-Employee
Grunt.js


● node npm package




                     https://npmjs.org/browse/depended/grunt
                     http://benalman.com/news/2012/08/why-grunt/
Grunt.js


● node npm package
● 3700++ Watches on Github




                             https://npmjs.org/browse/depended/grunt
                             http://benalman.com/news/2012/08/why-grunt/
Grunt.js


● node npm package
● 3700++ Watches on Github
● TestSwarm, modernizr, jQuery,
  jQueryMobile



                             https://npmjs.org/browse/depended/grunt
                             http://benalman.com/news/2012/08/why-grunt/
Grunt.js


● node npm package
● 3700++ Watches on Github
● TestSwarm, modernizr, jQuery,
  jQueryMobile



                             https://npmjs.org/browse/depended/grunt
                             http://benalman.com/news/2012/08/why-grunt/
Basic Grunt.js tasks
● init
  Generate project scaffolding from a predefined template
Create Standards with
Bootstrapping/ Templates
Basic Grunt.js tasks
● concat
  Concatenate files
● init
  Generate project scaffolding from a predefined template
● lint
  Validate files with JSHint
● min
  Minify files with UglifyJS.
Basic Grunt.js tasks
● init
  Generate project scaffolding from a predefined template
● lint
  Validate files with JSHint
● min
  Minify files with UglifyJS.
● server
  Start a static node web server
● test
  Run unit tests with nodeunit. (Jasmine support)
● qunit
  Run QUnit unit tests in a headless PhantomJS instance.
● watch
  Run predefined tasks whenever watched files change.
● concat
  Concatenate files
Ant
<target name="js-compile-all" description="What does it do?" unless="skip-js-compile">
   <echo>Executing my JS files in ${input.scripts.dir} ...</echo>
   <apply executable="java" dest="${output.scripts.dir}">
     <arg value="-jar"/>
     <arg path="${jar.lib.dir}/closure-compiler.jar"/>
     <arg lmaxine="--js"/>
     <srcfile/>
     <arg line="--js_output_file"/>
     <targetfile/>
     <fileset dir="${output.scripts.dir}" includes="**/*-main.debug.js"/>
     <mapper type="glob" from="*-main.debug.js" to="*-main.min.js"/>
   </apply>
   <echo>Finished manipulating mx JS files</echo>
</target>
Rake - Ruby
def uglify(script_file)
 output = `uglifyjs #{script_file}`

 #Did it work?
 if !$?.success?
   puts "Uglify Failed"
   Process.abort
 end

 output
end
Grunt.js
grunt.initConfig({
  min: {
    dist: {
      src: ['dist/built.js'],
      dest: 'dist/built.min.js'
    }
  }
});

                http://mechanics.flite.com/blog/2012/06/19/why-we-use-node-dot-js-and-grunt-to-build-javascript/
Easiest Syntax: JavaScript
grunt.initConfig({
  min: {
    dist: {
      src: ['dist/built.js'],
      dest: 'dist/built.min.js'
    }
  }
});

                http://mechanics.flite.com/blog/2012/06/19/why-we-use-node-dot-js-and-grunt-to-build-javascript/
JavaScript for everyone
"...even our I’d-rather-not-
touch-JavaScript-even-with-a-
very-long-stick
backend developers,
speak some JavaScript."

        http://mechanics.flite.com/blog/2012/06/19/why-we-use-node-dot-js-and-grunt-to-build-javascript/
Balance of extendability


     Declarative    Scripting
    Configuration   Approach
Build tool for the Web
Concepts of
 managing tasks
Grunt.js file:

●   grunt.loadNpmTasks('grunt-sample');
●   grunt.loadTasks(tasksPath)
●   grunt.loadTasks('tasks');
●   grunt.registerTask('default', 'lint qunit concat
    min');
Enriching Tasks
grunt.registerMultiTask(
   taskName, description, taskFunction
);
Enriching Tasks
grunt.registerHelper("helloWorld", function(){
   return "Hi you!!!";
})

grunt.helper('helloWorld');
Async-Support

var done = this.async; // tell grunt to do task async
setTimeout(function(){
  var isSuccessful = Math.random() > 0.5;
  done(isSuccessful);
}
Async-Support

var done = this.async; // tell grunt to do task async
setTimeout(function(){
  var isSuccessful = Math.random() > 0.5;
  done(isSuccessful);
}

this.requires('random');
Utils & Variables & more

●   Warn, Error, Fatal
●   grunt.utils._, grunt.utils.hooker
●   grunt.task.current.file
●   ...
Demo #1
Grunt.js and Yeoman, Continous Integration
Yeoman
Yeoman is a robust and opinionated
set of tools, libraries
and a workflow
that can help developers to build
beautiful, compelling web apps.

@By Paul Irish, Addy Osmani,
Sindre Sorhus, Mickael Daniel,
Eric Bidelman ...
Yeoman builds on top
of Grunt.js




●   package management like apt-get
DRY (Don't repeat yourself)
● Scaffolding & Prototyping
  Coding by convention
  Forcing
  to best practices
  CommonJS Module




                          http://dl.dropbox.com/u/39519/talks/io-tooling/index.html#21
Sharing best practices



"I love the backbone
boilerplate!"

Tony Juli 1, 2012 at 1:25 am
Demo #2
My seamless workflow
Any Questions ?
● Against Grunt.js as a build system
   http://blog.millermedeiros.com/node-js-ant-grunt-and-other-build-tools/

● Reply : Why Grunt.js
   http://benalman.com/news/2012/08/why-grunt/




david.amend@it-amend.de
Articles
Google IO, Better web app development
through tooling
http://dl.dropbox.com/u/39519/talks/io-tooling/index.html#21


Blog about last commit comments
http://www.commitlogsfromlastnight.com/


Grunt-modernizr, builder which runs in TravisCI
https://github.com/doctyper/grunt-modernizr


Continous Integration in general
http://www.slideshare.net/bhavinjavia/continuous-integration-and-builds


Example of grunt usage
http://mechanics.flite.com/blog/2012/06/19/why-we-use-node-dot-js-and-grunt-to-build-javascript/
Additional Slides
Grunt.js and Yeoman, Continous Integration
Goals
● Create a baseline for developers
● Improve existing solutions
● Share knownledge



       Email me: David.Amend@it-amend.de
You are different !
You are different !
http://incident57.com/codekit/
Tools to unify development
"I wrote a README the other day for a project ... and as I was writing it,
I realized that it was the sort of thing that might have intimidated the
hell out of me a couple of years ago, what with its casual mentions of
Node, npm, Homebrew, git, tests, and development and
production builds."...
Many members of the community – myself included – lacked
traditional programming experience. HTML, CSS, and JavaScript –
usually in the form of jQuery – were self-taught skills.
...here’s a new set of baseline skills required in order to be
successful as a front-end developer, and developers who don’t meet
this baseline are going to start feeling more and more left behind as
those who are sharing their knowledge start to assume that certain
things go without saying.
by Rebecca Murphy (+Paul Irish, Mike Taylor, Angus Croll, and Vlad Filippov)


                                                 http://rmurphey.com/blog/2012/04/12/a-baseline-for-front-end-developers/
http://jamesonjavascript.wordpress.com/2012/04/10/state-of-the-art/
Community rules
Grunt uses async for asynchronous function queue processing, dateformat for formatting dates and temporary for creating temporary files.
But on the other hand, I wanted synchronous globbing, and the excellent glob was async-only at the time… so I wrote my own. I even called it
glob-whatev so that people wouldn’t take it too seriously. Of course, I’d love to switch to glob now that it supports synchronous globbing, but
there’s at least one issue that’s blocking me from using it.
Build tools
ant, maven (Java)
nant (.NET)
make ( C++)
rake / Caphistrano
http://www.commitlogsfromlastnight.com
More responsibility
Grunt.js and Yeoman, Continous Integration
Fun @ work
Grunt.js and Yeoman, Continous Integration
ant, maven (Java); nant (.NET) make ( C++) rake / Caphistrano node: buildr.npm Smoosh Gear.js Rivet
Roto
ant, maven (Java); nant (.NET) make ( C++) rake / Caphistrano node: buildr.npm Smoosh Gear.js Rivet
Roto
Seamless Integration




 ●   Anonymous metrics report to
     Google Analytics
XXX aims to improve the
quality of software, and to
reduce the time taken to deliver it, by
replacing the traditional practice
of applying quality control after completing all
development.

                                            http://en.wikipedia.org/
XXX aims to improve the
quality of software, and to
reduce the time taken to deliver it, by replacing
               applying
the traditional practice of
quality control after
completing all development.
The process of
 Continous Integration

                             Developer


Developer
                                         Business/
                                         -Customer
            Code


                   CI-Webserver

                                   QA-Employee
Continous Integration




●   clean - compile - test - package
●   Continous Delivery
●   Metrics
●   Saving time
                            http://www.slideshare.net/bhavinjavia/continuous-integration-and-builds
                            https://github.com/codedance/Retaliation
                                                    http://www.cuberick.com/2008/10/continuous-int
Grunt-Contrib tasks
●   bump
●   clean
●   coffee
●   compress
●   copy
●   JST + Jade + Handlebars
●   Mincss, Less, Stylus
●   Require.js
●   Yuidoc
... as well as:
● Confess
    Generate Cache Manifest

●   GrundIcon, OptiPNG & jpegtran
●   Sass & Compass
●   JsTestDriver
●   Ant-Adapter               https://github.com/millermedeiros/node-ant




                                                                     https://npmjs.org/browse/depended/grunt

More Related Content

What's hot

Building a Single-Page App: Backbone, Node.js, and Beyond
Building a Single-Page App: Backbone, Node.js, and BeyondBuilding a Single-Page App: Backbone, Node.js, and Beyond
Building a Single-Page App: Backbone, Node.js, and Beyond
Spike Brehm
 
Production Ready Javascript With Grunt
Production Ready Javascript With GruntProduction Ready Javascript With Grunt
Production Ready Javascript With Grunt
XB Software, Ltd.
 
Vue 淺談前端建置工具
Vue 淺談前端建置工具Vue 淺談前端建置工具
Vue 淺談前端建置工具
andyyou
 
Webpack slides
Webpack slidesWebpack slides
An Intro into webpack
An Intro into webpackAn Intro into webpack
An Intro into webpack
Squash Apps Pvt Ltd
 
Webpack DevTalk
Webpack DevTalkWebpack DevTalk
Webpack DevTalk
Alessandro Bellini
 
Packing it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowPacking it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to now
Derek Willian Stavis
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Matthew Davis
 
Introduction to Express and Grunt
Introduction to Express and GruntIntroduction to Express and Grunt
Introduction to Express and Grunt
Peter deHaan
 
Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack Introduction
Anjali Chawla
 
Webpack: from 0 to 2
Webpack: from 0 to 2Webpack: from 0 to 2
Webpack: from 0 to 2
Alessandro Bellini
 
005. a React project structure
005. a React project structure005. a React project structure
005. a React project structure
Binh Quan Duc
 
Webpack
Webpack Webpack
Webpack
DataArt
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
Brian Shannon
 
007. Redux middlewares
007. Redux middlewares007. Redux middlewares
007. Redux middlewares
Binh Quan Duc
 
Bundling your front-end with Webpack
Bundling your front-end with WebpackBundling your front-end with Webpack
Bundling your front-end with Webpack
Danillo Corvalan
 
An Introduction to Vuejs
An Introduction to VuejsAn Introduction to Vuejs
An Introduction to Vuejs
Paddy Lock
 
Vue.js
Vue.jsVue.js
Vue.js
BADR
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
Ioan Eugen Stan
 
WordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQLWordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQL
houzman
 

What's hot (20)

Building a Single-Page App: Backbone, Node.js, and Beyond
Building a Single-Page App: Backbone, Node.js, and BeyondBuilding a Single-Page App: Backbone, Node.js, and Beyond
Building a Single-Page App: Backbone, Node.js, and Beyond
 
Production Ready Javascript With Grunt
Production Ready Javascript With GruntProduction Ready Javascript With Grunt
Production Ready Javascript With Grunt
 
Vue 淺談前端建置工具
Vue 淺談前端建置工具Vue 淺談前端建置工具
Vue 淺談前端建置工具
 
Webpack slides
Webpack slidesWebpack slides
Webpack slides
 
An Intro into webpack
An Intro into webpackAn Intro into webpack
An Intro into webpack
 
Webpack DevTalk
Webpack DevTalkWebpack DevTalk
Webpack DevTalk
 
Packing it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowPacking it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to now
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 
Introduction to Express and Grunt
Introduction to Express and GruntIntroduction to Express and Grunt
Introduction to Express and Grunt
 
Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack Introduction
 
Webpack: from 0 to 2
Webpack: from 0 to 2Webpack: from 0 to 2
Webpack: from 0 to 2
 
005. a React project structure
005. a React project structure005. a React project structure
005. a React project structure
 
Webpack
Webpack Webpack
Webpack
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
 
007. Redux middlewares
007. Redux middlewares007. Redux middlewares
007. Redux middlewares
 
Bundling your front-end with Webpack
Bundling your front-end with WebpackBundling your front-end with Webpack
Bundling your front-end with Webpack
 
An Introduction to Vuejs
An Introduction to VuejsAn Introduction to Vuejs
An Introduction to Vuejs
 
Vue.js
Vue.jsVue.js
Vue.js
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
WordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQLWordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQL
 

Similar to Grunt.js and Yeoman, Continous Integration

Grunt training deck
Grunt training deckGrunt training deck
Grunt training deck
James Ford
 
Continuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applicationsContinuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applications
Evgeniy Kuzmin
 
Grunt Continuous Development of the Front End Tier
Grunt Continuous Development of the Front End TierGrunt Continuous Development of the Front End Tier
Grunt Continuous Development of the Front End Tier
Erick Brito
 
Continuous integration / continuous delivery
Continuous integration / continuous deliveryContinuous integration / continuous delivery
Continuous integration / continuous delivery
EatDog
 
Towards Continuous Deployment with Django
Towards Continuous Deployment with DjangoTowards Continuous Deployment with Django
Towards Continuous Deployment with Django
Roger Barnes
 
フロントエンドエンジニア(仮) 〜え、ちょっとフロントやること多すぎじゃない!?〜
フロントエンドエンジニア(仮) 〜え、ちょっとフロントやること多すぎじゃない!?〜フロントエンドエンジニア(仮) 〜え、ちょっとフロントやること多すぎじゃない!?〜
フロントエンドエンジニア(仮) 〜え、ちょっとフロントやること多すぎじゃない!?〜
Koji Ishimoto
 
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Evgeniy Kuzmin
 
Code driven development in drupal
Code driven development in drupalCode driven development in drupal
Code driven development in drupal
Andriy Yun
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
Evan Mullins
 
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(下)JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
Simon Su
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
Oded Sagir
 
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Brian Culver
 
Building JavaScript
Building JavaScriptBuilding JavaScript
Building JavaScript
Brady Clifford
 
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
David Amend
 
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento CloudMeet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Lyzun Oleksandr
 
Infrastructure Management in GCP
Infrastructure Management in GCPInfrastructure Management in GCP
Infrastructure Management in GCP
Dana Hoffman
 
Droidcon Paris 2015
Droidcon Paris 2015Droidcon Paris 2015
Droidcon Paris 2015
Renaud Boulard
 
Deploying software at Scale
Deploying software at ScaleDeploying software at Scale
Deploying software at Scale
Kris Buytaert
 
IDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase SessionIDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase Session
Brion Mario
 

Similar to Grunt.js and Yeoman, Continous Integration (20)

Grunt training deck
Grunt training deckGrunt training deck
Grunt training deck
 
Continuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applicationsContinuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applications
 
Grunt Continuous Development of the Front End Tier
Grunt Continuous Development of the Front End TierGrunt Continuous Development of the Front End Tier
Grunt Continuous Development of the Front End Tier
 
Continuous integration / continuous delivery
Continuous integration / continuous deliveryContinuous integration / continuous delivery
Continuous integration / continuous delivery
 
Towards Continuous Deployment with Django
Towards Continuous Deployment with DjangoTowards Continuous Deployment with Django
Towards Continuous Deployment with Django
 
フロントエンドエンジニア(仮) 〜え、ちょっとフロントやること多すぎじゃない!?〜
フロントエンドエンジニア(仮) 〜え、ちょっとフロントやること多すぎじゃない!?〜フロントエンドエンジニア(仮) 〜え、ちょっとフロントやること多すぎじゃない!?〜
フロントエンドエンジニア(仮) 〜え、ちょっとフロントやること多すぎじゃない!?〜
 
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
 
Code driven development in drupal
Code driven development in drupalCode driven development in drupal
Code driven development in drupal
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
 
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
 
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(下)JCConf 2015  - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
 
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
 
Building JavaScript
Building JavaScriptBuilding JavaScript
Building JavaScript
 
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
 
Meet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento CloudMeet Magento Spain 2019 - Our Experience with Magento Cloud
Meet Magento Spain 2019 - Our Experience with Magento Cloud
 
Infrastructure Management in GCP
Infrastructure Management in GCPInfrastructure Management in GCP
Infrastructure Management in GCP
 
Droidcon Paris 2015
Droidcon Paris 2015Droidcon Paris 2015
Droidcon Paris 2015
 
Deploying software at Scale
Deploying software at ScaleDeploying software at Scale
Deploying software at Scale
 
IDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase SessionIDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase Session
 

More from David Amend

Componentization css angular
Componentization css angularComponentization css angular
Componentization css angular
David Amend
 
Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1
David Amend
 
Performance monitoring measurement angualrjs single page apps with phantomas
Performance monitoring measurement angualrjs single page apps with phantomasPerformance monitoring measurement angualrjs single page apps with phantomas
Performance monitoring measurement angualrjs single page apps with phantomas
David Amend
 
Angularjs practical project experiences with javascript development in a bank
Angularjs practical project experiences with javascript development in a bankAngularjs practical project experiences with javascript development in a bank
Angularjs practical project experiences with javascript development in a bank
David Amend
 
Story about module management with angular.js
Story about module management with angular.jsStory about module management with angular.js
Story about module management with angular.js
David Amend
 
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.jsMulti modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
David Amend
 
Reasons to migrate to modern web development with JavaScript
Reasons to migrate to modern web development with JavaScriptReasons to migrate to modern web development with JavaScript
Reasons to migrate to modern web development with JavaScript
David Amend
 
Thin Server Architecture SPA, 5 years old presentation
Thin Server Architecture SPA, 5 years old presentationThin Server Architecture SPA, 5 years old presentation
Thin Server Architecture SPA, 5 years old presentation
David Amend
 
Javascript & Angular .js for the enterprise, lessons learned, typescript scal...
Javascript & Angular .js for the enterprise, lessons learned, typescript scal...Javascript & Angular .js for the enterprise, lessons learned, typescript scal...
Javascript & Angular .js for the enterprise, lessons learned, typescript scal...
David Amend
 
Grunt Advanced Vol 2, Plugins Text I/O with fun
Grunt Advanced Vol 2, Plugins Text I/O with funGrunt Advanced Vol 2, Plugins Text I/O with fun
Grunt Advanced Vol 2, Plugins Text I/O with fun
David Amend
 
Client Vs. Server Rendering
Client Vs. Server RenderingClient Vs. Server Rendering
Client Vs. Server Rendering
David Amend
 
Grunt js for the Enterprise Vol.1: Frontend Performance with Phantomas
Grunt js for the Enterprise Vol.1: Frontend Performance with PhantomasGrunt js for the Enterprise Vol.1: Frontend Performance with Phantomas
Grunt js for the Enterprise Vol.1: Frontend Performance with Phantomas
David Amend
 
Gwt widget frameworks_presentation
Gwt widget frameworks_presentationGwt widget frameworks_presentation
Gwt widget frameworks_presentation
David Amend
 

More from David Amend (13)

Componentization css angular
Componentization css angularComponentization css angular
Componentization css angular
 
Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1
 
Performance monitoring measurement angualrjs single page apps with phantomas
Performance monitoring measurement angualrjs single page apps with phantomasPerformance monitoring measurement angualrjs single page apps with phantomas
Performance monitoring measurement angualrjs single page apps with phantomas
 
Angularjs practical project experiences with javascript development in a bank
Angularjs practical project experiences with javascript development in a bankAngularjs practical project experiences with javascript development in a bank
Angularjs practical project experiences with javascript development in a bank
 
Story about module management with angular.js
Story about module management with angular.jsStory about module management with angular.js
Story about module management with angular.js
 
Multi modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.jsMulti modularized project setup with gulp, typescript and angular.js
Multi modularized project setup with gulp, typescript and angular.js
 
Reasons to migrate to modern web development with JavaScript
Reasons to migrate to modern web development with JavaScriptReasons to migrate to modern web development with JavaScript
Reasons to migrate to modern web development with JavaScript
 
Thin Server Architecture SPA, 5 years old presentation
Thin Server Architecture SPA, 5 years old presentationThin Server Architecture SPA, 5 years old presentation
Thin Server Architecture SPA, 5 years old presentation
 
Javascript & Angular .js for the enterprise, lessons learned, typescript scal...
Javascript & Angular .js for the enterprise, lessons learned, typescript scal...Javascript & Angular .js for the enterprise, lessons learned, typescript scal...
Javascript & Angular .js for the enterprise, lessons learned, typescript scal...
 
Grunt Advanced Vol 2, Plugins Text I/O with fun
Grunt Advanced Vol 2, Plugins Text I/O with funGrunt Advanced Vol 2, Plugins Text I/O with fun
Grunt Advanced Vol 2, Plugins Text I/O with fun
 
Client Vs. Server Rendering
Client Vs. Server RenderingClient Vs. Server Rendering
Client Vs. Server Rendering
 
Grunt js for the Enterprise Vol.1: Frontend Performance with Phantomas
Grunt js for the Enterprise Vol.1: Frontend Performance with PhantomasGrunt js for the Enterprise Vol.1: Frontend Performance with Phantomas
Grunt js for the Enterprise Vol.1: Frontend Performance with Phantomas
 
Gwt widget frameworks_presentation
Gwt widget frameworks_presentationGwt widget frameworks_presentation
Gwt widget frameworks_presentation
 

Grunt.js and Yeoman, Continous Integration

  • 1. Grunt.js The build tool for the web for the web-experience david.amend@it-amend.de
  • 4. Content ● Why a build tool is needed for CI ? ● Why Grunt.js ? ● Demo ● Why Yeoman perfects Grunt.js
  • 5. Supports Development Continuous integration aims to improve the quality of software, and to reduce the time taken to deliver it, by replacing the traditional practice of applying quality control after completing all development.
  • 6. The process of Continous Integration Developer Code CI-Server
  • 7. The process of Continous Integration Cloud Webserver Developer Developer Business/ -Customer Code CI-Server QA-Employee
  • 8. The process of Continous Integration Cloud Webserver Developer Developer Business/ -Customer Code CI-Server QA-Employee
  • 9. Grunt.js ● node npm package https://npmjs.org/browse/depended/grunt http://benalman.com/news/2012/08/why-grunt/
  • 10. Grunt.js ● node npm package ● 3700++ Watches on Github https://npmjs.org/browse/depended/grunt http://benalman.com/news/2012/08/why-grunt/
  • 11. Grunt.js ● node npm package ● 3700++ Watches on Github ● TestSwarm, modernizr, jQuery, jQueryMobile https://npmjs.org/browse/depended/grunt http://benalman.com/news/2012/08/why-grunt/
  • 12. Grunt.js ● node npm package ● 3700++ Watches on Github ● TestSwarm, modernizr, jQuery, jQueryMobile https://npmjs.org/browse/depended/grunt http://benalman.com/news/2012/08/why-grunt/
  • 13. Basic Grunt.js tasks ● init Generate project scaffolding from a predefined template
  • 15. Basic Grunt.js tasks ● concat Concatenate files ● init Generate project scaffolding from a predefined template ● lint Validate files with JSHint ● min Minify files with UglifyJS.
  • 16. Basic Grunt.js tasks ● init Generate project scaffolding from a predefined template ● lint Validate files with JSHint ● min Minify files with UglifyJS. ● server Start a static node web server ● test Run unit tests with nodeunit. (Jasmine support) ● qunit Run QUnit unit tests in a headless PhantomJS instance. ● watch Run predefined tasks whenever watched files change. ● concat Concatenate files
  • 17. Ant <target name="js-compile-all" description="What does it do?" unless="skip-js-compile"> <echo>Executing my JS files in ${input.scripts.dir} ...</echo> <apply executable="java" dest="${output.scripts.dir}"> <arg value="-jar"/> <arg path="${jar.lib.dir}/closure-compiler.jar"/> <arg lmaxine="--js"/> <srcfile/> <arg line="--js_output_file"/> <targetfile/> <fileset dir="${output.scripts.dir}" includes="**/*-main.debug.js"/> <mapper type="glob" from="*-main.debug.js" to="*-main.min.js"/> </apply> <echo>Finished manipulating mx JS files</echo> </target>
  • 18. Rake - Ruby def uglify(script_file) output = `uglifyjs #{script_file}` #Did it work? if !$?.success? puts "Uglify Failed" Process.abort end output end
  • 19. Grunt.js grunt.initConfig({ min: { dist: { src: ['dist/built.js'], dest: 'dist/built.min.js' } } }); http://mechanics.flite.com/blog/2012/06/19/why-we-use-node-dot-js-and-grunt-to-build-javascript/
  • 20. Easiest Syntax: JavaScript grunt.initConfig({ min: { dist: { src: ['dist/built.js'], dest: 'dist/built.min.js' } } }); http://mechanics.flite.com/blog/2012/06/19/why-we-use-node-dot-js-and-grunt-to-build-javascript/
  • 21. JavaScript for everyone "...even our I’d-rather-not- touch-JavaScript-even-with-a- very-long-stick backend developers, speak some JavaScript." http://mechanics.flite.com/blog/2012/06/19/why-we-use-node-dot-js-and-grunt-to-build-javascript/
  • 22. Balance of extendability Declarative Scripting Configuration Approach
  • 23. Build tool for the Web
  • 24. Concepts of managing tasks Grunt.js file: ● grunt.loadNpmTasks('grunt-sample'); ● grunt.loadTasks(tasksPath) ● grunt.loadTasks('tasks'); ● grunt.registerTask('default', 'lint qunit concat min');
  • 25. Enriching Tasks grunt.registerMultiTask( taskName, description, taskFunction );
  • 26. Enriching Tasks grunt.registerHelper("helloWorld", function(){ return "Hi you!!!"; }) grunt.helper('helloWorld');
  • 27. Async-Support var done = this.async; // tell grunt to do task async setTimeout(function(){ var isSuccessful = Math.random() > 0.5; done(isSuccessful); }
  • 28. Async-Support var done = this.async; // tell grunt to do task async setTimeout(function(){ var isSuccessful = Math.random() > 0.5; done(isSuccessful); } this.requires('random');
  • 29. Utils & Variables & more ● Warn, Error, Fatal ● grunt.utils._, grunt.utils.hooker ● grunt.task.current.file ● ...
  • 32. Yeoman Yeoman is a robust and opinionated set of tools, libraries and a workflow that can help developers to build beautiful, compelling web apps. @By Paul Irish, Addy Osmani, Sindre Sorhus, Mickael Daniel, Eric Bidelman ...
  • 33. Yeoman builds on top of Grunt.js ● package management like apt-get
  • 34. DRY (Don't repeat yourself) ● Scaffolding & Prototyping Coding by convention Forcing to best practices CommonJS Module http://dl.dropbox.com/u/39519/talks/io-tooling/index.html#21
  • 35. Sharing best practices "I love the backbone boilerplate!" Tony Juli 1, 2012 at 1:25 am
  • 38. Any Questions ? ● Against Grunt.js as a build system http://blog.millermedeiros.com/node-js-ant-grunt-and-other-build-tools/ ● Reply : Why Grunt.js http://benalman.com/news/2012/08/why-grunt/ david.amend@it-amend.de
  • 39. Articles Google IO, Better web app development through tooling http://dl.dropbox.com/u/39519/talks/io-tooling/index.html#21 Blog about last commit comments http://www.commitlogsfromlastnight.com/ Grunt-modernizr, builder which runs in TravisCI https://github.com/doctyper/grunt-modernizr Continous Integration in general http://www.slideshare.net/bhavinjavia/continuous-integration-and-builds Example of grunt usage http://mechanics.flite.com/blog/2012/06/19/why-we-use-node-dot-js-and-grunt-to-build-javascript/
  • 42. Goals ● Create a baseline for developers ● Improve existing solutions ● Share knownledge Email me: David.Amend@it-amend.de
  • 46. Tools to unify development "I wrote a README the other day for a project ... and as I was writing it, I realized that it was the sort of thing that might have intimidated the hell out of me a couple of years ago, what with its casual mentions of Node, npm, Homebrew, git, tests, and development and production builds."... Many members of the community – myself included – lacked traditional programming experience. HTML, CSS, and JavaScript – usually in the form of jQuery – were self-taught skills. ...here’s a new set of baseline skills required in order to be successful as a front-end developer, and developers who don’t meet this baseline are going to start feeling more and more left behind as those who are sharing their knowledge start to assume that certain things go without saying. by Rebecca Murphy (+Paul Irish, Mike Taylor, Angus Croll, and Vlad Filippov) http://rmurphey.com/blog/2012/04/12/a-baseline-for-front-end-developers/
  • 48. Community rules Grunt uses async for asynchronous function queue processing, dateformat for formatting dates and temporary for creating temporary files. But on the other hand, I wanted synchronous globbing, and the excellent glob was async-only at the time… so I wrote my own. I even called it glob-whatev so that people wouldn’t take it too seriously. Of course, I’d love to switch to glob now that it supports synchronous globbing, but there’s at least one issue that’s blocking me from using it.
  • 49. Build tools ant, maven (Java) nant (.NET) make ( C++) rake / Caphistrano
  • 55. ant, maven (Java); nant (.NET) make ( C++) rake / Caphistrano node: buildr.npm Smoosh Gear.js Rivet Roto
  • 56. ant, maven (Java); nant (.NET) make ( C++) rake / Caphistrano node: buildr.npm Smoosh Gear.js Rivet Roto
  • 57. Seamless Integration ● Anonymous metrics report to Google Analytics
  • 58. XXX aims to improve the quality of software, and to reduce the time taken to deliver it, by replacing the traditional practice of applying quality control after completing all development. http://en.wikipedia.org/
  • 59. XXX aims to improve the quality of software, and to reduce the time taken to deliver it, by replacing applying the traditional practice of quality control after completing all development.
  • 60. The process of Continous Integration Developer Developer Business/ -Customer Code CI-Webserver QA-Employee
  • 61. Continous Integration ● clean - compile - test - package ● Continous Delivery ● Metrics ● Saving time http://www.slideshare.net/bhavinjavia/continuous-integration-and-builds https://github.com/codedance/Retaliation http://www.cuberick.com/2008/10/continuous-int
  • 62. Grunt-Contrib tasks ● bump ● clean ● coffee ● compress ● copy ● JST + Jade + Handlebars ● Mincss, Less, Stylus ● Require.js ● Yuidoc
  • 63. ... as well as: ● Confess Generate Cache Manifest ● GrundIcon, OptiPNG & jpegtran ● Sass & Compass ● JsTestDriver ● Ant-Adapter https://github.com/millermedeiros/node-ant https://npmjs.org/browse/depended/grunt