Shaun O'Connell
Front-end Developer, Mentor, and Interaction Designer, based in Wellington, New Zealand
Web Performance
Better user experiences
Development mastery
Efficient & available
Front-end Development Mastery
Accessibility
Semantic HTML
Progressive Enhancement
Web Standards
Web Performance
Mobile First
Styleguides
ADDICTIVE!
Chasing perfection is bad, mmmkay.
What about the benefits?
9% more traffic for every 400ms
10% increase in revenue for every 1s
Who has a part to play?
Front-end Developer
Designer
Back-end Developer
DevOps / Sys admin
What parts to play?
Front-end
Design
Back-end
SA
BED
FED
Designer
HTML
CSS
JavaScript
Media
Animation
Views
Code
Data
CDN
DNS
HTTP
Memcache
Server
What parts to play?
Front-end
Design
Back-end
Full-stack Developer / Unicorn
ALL THE THINGS
Just do these things…
"It depends."
Use a CDN
Use a Front-end Developer
Some principles to work towards
HTML + Inline CSS < 14KB for mobile
Your site should be visible within 1s
JavaScript Last™
Time-to-Start-Render is the metric
Measure all the time.
The goalposts are moving
Metrics are shifting from networking to User Experience
e.g. SpeedIndex, Painting, Time-To-First-Render, Visual completeness
Solutions are about to change, again…
Browser improvements mean some old techniques are unnecessary e.g. Domain Sharding
HTTP 1.0
Nov 2011
May 2015
Jun 1999
Feb 1996
HTTP 1.1
SPDY
HTTP/2
A little history…
What will HTTP/2 change?
…basically, less concatenation
When can we switch to HTTP/2?
…or when old IE dies.
Tools
Measurement
WebPageTest.org
Inspector
ImageAlpha
ImageOptim
Images
App stuff
Gems
Middleman
Middleman
A static-site generator with a Rails-like Asset Pipeline
Includes…
Gems
Cutting down on bloat
Faster rendering
All you need is WOFF
Use a custom subset
font-face * weight * style * characters = ALOT
Droid Sans Regular
Which format?
JPEG for photos
GIF for animations
SVG for simple images
PNG for everything else
28,251
22,048
5,665
~80% off
24-bit PNG
24-bit PNG
5-bit PNG
Up to 16.7m
Up to 16.7m
32
Original
No metadata
Indexed
~22% off
Colours
Bytes
Savings
Format
File
youmightnotneedjquery.com
var firstListItems = document.querySelectorAll('li:first-child');
var i = 0,
itemsLength = firstListItems.length;
for (i; i < itemsLength; i++) {
firstListItems[i].classList.add('active');
firstListItems[i].addEventListener('click', function(e){
e.target.classList.remove('active');
});
}
var $firstListItems = $('li:first-child');
$firstListItems.each(function(){
$(this).addClass('active');
$(this).on('click', function(e){
$(e.target).removeClass('active');
});
});
document.querySelectorAll()
element.classList.method()
element.addEventListener()
9+
10+
8+
Pop quiz
JavaScript API
IE Version
@import "_defaults.scss";
@import "_headings.scss";
@import "_layouts.scss";
/* etc */
/* --- Pages --- */
@import "pages/_home.scss";
@import "_defaults.scss";
@import "_headings.scss";
@import "_layouts.scss";
@import "_tables";
@import "_etc";
@import "_other_elements";
/* --- Pages --- */
@import "pages/_about.scss";
@import "pages/_team.scss";
@import "pages/_jobs.scss";
/* etc */
homepage.scss
rest-of-site.scss
Inject into <head>
Use a <link>
Inline your homepage CSS
HERE BE DRAGONS!!1!
As for the actual CSS…
Fastest paint
Real-world results
https://addressfinder.nz
https://abletech.nz
By Shaun O'Connell
These slides were used in a talk given to the Abletech Team on Friday the 26th of June
Front-end Developer, Mentor, and Interaction Designer, based in Wellington, New Zealand