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.
@richmarr
I love optimising stuff
Currently founding an insurance company
#ThingsIThoughtIdNeverSay
Sizlate
@simonmcmanus
- Templates are pure HTML
- Inject data and control via Sizzle (jQuery selectors)
- #awesome
The near-legendary @simonmcmanus should be here somewhere...
Damn, I love zooming in
res.render('home', {
selectors: {
'a': {
href: 'http://yahoo.com',
title: 'yahoo',
innerHTML: 'yahoo'
}
}
});
res.render('home', {
selectors: {
'ul#people': {
partial: 'person',
data: [
{ name: 'bob' },
{ name: 'anna' }
]
}
}
});
How to optimise this?
- File I/O
- DOM creation/maniputation
- DOM Serialisation
- Build DOM
- Inject placeholders
- Serialise, split on placeholders
compiledTemplate = [
"<html><body> My name is <span class='name'>",
undefined,
"</span> </body></html>",
];
compiledTemplate.index = { "span.name":0 };
- localhost === crap
- speed-only === crap
- trivial templates === crap