Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

Automating Website Optimizations


{
  "author": "Mickael Daniel",
  "github": "http://github.com/mklabs",
  "twitter": "@mklabs",
  "date": "new Date('Mon Apr 10 2012 19:00:00 GMT+0200')"
  "dependencies": {
    "your-attention": "1.0.0"
  }
}

h5bp/node-build-script

A Grunt Plugin

A Grunt Plugin - Install

1. Install the plugin

# next to your project's gruntfile
$ npm install http://nodeload.github.com/h5bp/node-build-script/tarball/master

2. Add the plugin as a project dependency in your package.json

"dependencies": {
  "node-build-script": "http://nodeload.github.com/h5bp/node-build-script/tarball/master"
}

A Grunt Plugin - Install

Load the plugin tasks - In your gruntfile:

...
// Load the plugin tasks and helpers
grunt.loadNpmTasks('node-build-script')

// Default task.
grunt.registerTask('default', 'lint qunit concat min');
...

A Grunt Plugin - Usage

$ grunt --help

A Grunt Plugin - Tasks

A Grunt Plugin - Tasks

In addition to those tasks, there are a few additional tasks to help you in the process:

socket.io + watch combo

Gives you a great development environment

socket.io + watch combo

process and build script needs to be almost immediate in this context

and node is a pretty good candidate for that :p

An experimental JSDOM based build script

The idea grown and original came from @necolas proposal.

DOM-based build script can tremendously reduce the amount of configuration.

If not simply removing the need of confirmation.

An experimental JSDOM based build script

An experimental JSDOM based build script

An experimental JSDOM based build script

How it works

https://github.com/h5bp/node-build-script/wiki/dom

JSDOM based - Plugins

A plugin is a special jQuery "plugin" that can use the node (or grunt) api to do their task.

The following plugins are implemented

JSDOM Based - Configuration

var h5bp = require("node-build-script");

module.exports = function(grunt) {

  grunt.initConfig({
      ...,

      dom: {
          files: ["*.html", "views/**/*.html"],
          "script[data-build]"    : h5bp.plugins.script,
          "link"                  : h5bp.plugins.link,
          "img"                   : h5bp.plugins.img,
          "script, link, img"     : h5bp.plugins.rev
      },

      ...
  });

};

next h5bp/node-build-script

next h5bp/node-build-script

next h5bp/node-build-script

Try it yourself

See the gist

https://raw.github.com/gist/c20d4310c005e31a5cfe/install.sh

$ curl https://raw.github.com/gist/c20d4310c005e31a5cfe/install.sh | sh
;