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.
{
"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"
}
}
automate the boring repetitive parts
hard to dev with optimized code (but fast sites are important)
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
...
Ant
ant is right for some
ant is far from respect
fs = require "fs"
option "-o", "--output [DIR]", "directory for compiled code"
task "minify", "Minify the resulting application file after build", ->
exec "java -jar "/home/stan/public/compiler.jar" --js lib/app.js --js_output_file lib/app.production.js", (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
desc("This is the default task.");
task("default", function (params) {
console.log("This is the default task.");
});
new Queue("release version")
.task("files", ["./js/test1.js", "./js/test2.js"])
.task("concat")
.task("jsminify")
.task("write", { name: "./build/test-min.js" })
.run();
module.exports = function(grunt) {
// Create a new task.
grunt.registerTask("awesome", "Print out "awesome!!!"", function() {
var awesome = grunt.helper("awesome");
grunt.log.write(awesome);
});
// Register a helper.
grunt.registerHelper("awesome", function() {
return "awesome!!!";
});
};
concat files
ant is great at all of those
That's where things get interresting
<link rel="stylesheets" href="file.css">
is renamed into
<link rel="stylesheets" href="e207ea1.file.css">
3 lines of node
var fs = require("fs"),
crypto = require("crypto");
var hash = crypto.createHash("md5");
hash.update(fs.readFileSync("./path/to/file.css"));
console.log(hash.digest("hex"));
// >> e207ea1eeb616799f29d679e1fdc2415
console.logdebugger;...// env=prod
// dont try this at home!
while(true) console.log("log all day long!");
// end:prod
<link rel="stylesheets" href="../4b6cd983.file.css">
to
<link rel="stylesheets" href="https://a248.e.akamai.net/youraccount/4b6cd983.file.css">
is easy now
but datauris are better :p (fit more or less the same role)
serve IE6 & 7 MHTML
serve IE6 & 7 MHTML
Consider droping support for ie6/7
and just go for base-64 encoded img < 32kb
Grunt has phantomjs builtin support for headless testing
Confess in next h5bp/node-build-script?
HTML Minification
With the fantastic html-minifier from kangax
Ant / Make / Rake / Jake / Cake / Grunt / Bash / Python
✔ pick one
☺ configure it once
✌ use it