Sourcecode of the demos (including an epic readme) available over here.
Grunt vs. Gulp vs. Brunch vs. Broccoli … not our topic today.
Let’s have a look at Grunt
Source → Magic happens → Destination
Install the Grunt CLI globally with
npm install -g grunt-cli
Our example project can now be installed with:
cd ~/my/path/
git clone ssh://git@github.com:mischah/js-tooling-demo.git
npm install
Enter:
grunt tasks
to see the available tasks.
The tasks are configured within Gruntfile.js
The dependencies for the tasks are defined within package.json
Go to Git Tag level-1
(»Empty Grunt Setup«) to start with:
Perf matters → minify and concatenate your JavaScript automated with Grunt.
Check Git Tag level-2
(»Minify and concatenate«) to see how to handle these kind of tasks.
JavaScript Linting = Quality Assurance.
Both configurable via dot files within the project.
See this slide deck of mine for details http://de.slideshare.net/mischah/js-linting-en
Check Git Tag level-3
(»Linting«) to see how to handle these kind of tasks.
Documentation via DocBlock comments as known from Javadoc.
The most used tools:
We are going to use JSDoc over here.
Check Git Tag level-4
(»Documentation«) to see how to handle generating the docs.
Analyze and benchmark code complexity with »plato«.
Example reports on popular projects:
See plato and the corresponding Grunt task
plato is based on https://github.com/philbooth/complexity-report. This is place to read about how to interpret the metrics.
Check Git Tag level-5
(»Code complexity«) to see how easy it is to configure plato.
Hint:
Add your reports
directory to version control to observe the changes in complexity during development within the team.
grunt-contrib-connect is one possibility to start a static web server.
Check Git Tag level-6
(»Dev server«) to see whats needed to setup a local dev server.
Bower has many analogies to npm (
package.json
vs.
bower.json
), but:
.bowerrc
{
“directory”: “libs”
}
Install the Bower CLI globally with
npm install -g bower
bower install jquery-ui
bower list
bower install jquery#1.10
bower search normalize
bower install normalize.css
bower init
bower install bootstrap
bower list
bower install bootstrap --save
bower install
Check Git Tag level-7
(»Bower«) to see an example bower setup.
3 possible choices to handle the dependencies of your code.
require('modules')
in the browser (CommonJS)They all have their own pitfalls. Choose wisely (°ロ°)☝
Straight forward Unit-Tests with »Nodeunit«
Test respectively Behavior-Driven JavaScript with Jasmine
Framework agnostic unit testing on real devices offering simple integration with Jenkins, Travis etc.
Yeoman helps you kickstart new projects with interactive »Generators«:
Install the Yeoman CLI globally with
npm install -g yo
See http://yeoman.io
# Install the generator globally
npm install -g generator-angular
# Make a new directory, and cd into it
mkdir my-new-project && cd $_
#Run yo angular, optionally passing an app name:
yo angular [app-name]
#Run `grunt` for building and `grunt serve` for preview
JavaScript-Development for »The Enterprise« with TypeScript
Related:
LiveReload via Browser Extension
LiveReload knowledgebase
Link list with selected ressources
JavaScript The Right Way
Solid JavaScript Coding Guidelines
Idiomatic JavaScript
Excellent Free books
Eloquent JavaScript
Learning JavaScript Design Patterns
You Don't Know JS (book series)
Slide decks
Front-end Tooling Workflows
Twitter: @mkuehnel
E-Mail: mail@michael-kuehnel.de