On Github kasperisager / presentation-tooling
An introduction to the world of Frontend Tooling
Tightly coupled server and client
Often has a server-side asset pipeline
Javascript (mostly) used decoratively
Server: Data-driven API (typically JSON)
Client: Self-contained Javascript app
Communication through AJAX/WebSockets
Where did the asset pipeline go? (hint: there is none)
So... who's going to bundle, optimize, and deploy this thing?
Take a wild guess...
Nonchalantly stolen from "Book of Modern Frontend Tooling"
Running your test spec – Automate it!
Concatenating scripts – Automate it!
Precompiling templates – Automate it!
Injecting dependencies – Automate it!
Grunt
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-task-a');
grunt.loadNpmTasks('grunt-task-b');
...
});
...
grunt.initConfig({
taskA: {
options: {
foo: 'bar'
},
glob: {
src: ['glob/**/*.baz'],
dest: 'dist/'
}
},
taskB: {
files: ['dist/**/*']
}
});
...
grunt.registerTask('default', [
'taskA',
'taskB'
]);
gulp.js
var gulp = require('gulp')
, taskA = require('gulp-task-a')
, taskB = require('gulp-task-b');
...
...
gulp.task('default', function () {
return gulp.src('glob/**/*.baz')
.pipe(taskA({
foo: 'bar'
}))
.pipe(taskB())
.pipe(gulp.dest('dist'));
});
Node.js has npm
Ruby has RubyGems
PHP has Composer
Python has pip
Heck, .NET has NuGet
Bower
Bonus step: Repeat the above after every single new release
# Eureka! $ bower install jquery # Stay up-to-date... $ bower update jquery # Nah, let's go vanilla... $ bower uninstall jquery
yo
# Scaffold out the front-end web app $ yo webapp # Install some dependencies $ bower install --save jquery bootstrap # Inject the dependencies into the app $ grunt bowerInstall # Boot up a development server... $ grunt serve # ...or build the app for production $ grunt
Yeoman + Bower + Grunt
$ yo reveal $ yo reveal:slide "Workflows for the Modern Web" $ yo reveal:slide "Section 1: Build Tools" $ ... $ bower install # Yo actually takes care of this $ grunt server
Reveal.js generator: https://github.com/slara/generator-reveal