delivering responsibly

39
Delivering Responsibly dev.Objective() 2016 Matt Busche @mrbusche

Upload: coldfusionconference

Post on 22-Jan-2017

77 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Delivering Responsibly

Delivering Responsibly

dev.Objective() 2016Matt Busche @mrbusche

Page 2: Delivering Responsibly

Questions?

Page 3: Delivering Responsibly

Responsive Design● An approach● Optimal user experience● Content first!● What do you users care about?

Page 4: Delivering Responsibly

Responsive Design● Platform agnostic● 94.64% + all mobile● Fluid user interface● Watches, phones, e-readers, tablets, laptops, monitors, etc● Two orientations for most

Page 5: Delivering Responsibly

Why Responsive Design?

https://opensignal.com/reports/fragmentation.php

Page 6: Delivering Responsibly

Why Responsive Design?

Desktop Mobile

Page 7: Delivering Responsibly

Why Responsive Design?● 333M smartphones sold Q3 2015● 6.2 visits on 2.6 devices● Mobile users > desktop

Page 8: Delivering Responsibly

Why Responsive Design?● 92% of adults have a cell phone● 68% have a smartphone● 73% have a desktop/laptop● 45% have a tablet

Page 9: Delivering Responsibly

Progressive Enhancement● Not just old browsers● Network behavior● 60% US still on 3G or 2G/Edge● Content blockers on iOS9

Page 10: Delivering Responsibly

Progressive Enhancement● CDN is down● Bad network● Select box to type ahead (Demo)● Add features if available (Demo)

Page 11: Delivering Responsibly

Progressive Enhancement● Image Enhancement

Page 12: Delivering Responsibly

Progressive Enhancement● Load minimum styles● EnhanceJS

Page 13: Delivering Responsibly

Progressive Web Apps● Progressive!● Short attention spans

Page 15: Delivering Responsibly

Progressive Web Apps● Service Worker

Page 16: Delivering Responsibly

Service Worker● 53.31% no IE, Edge, Safari● Offline functionality● Background sync● Add to home screen● Push notifications

Page 17: Delivering Responsibly

Push notifications● Service Worker Spec● Increase engagement● Demo / push.png

Page 18: Delivering Responsibly

Detecting Features● Modernizr

Page 19: Delivering Responsibly

Detecting Features● @supports - 69.52% (non IE, old Android)

Page 20: Delivering Responsibly

Progressive Disclosure

Page 21: Delivering Responsibly

Progressive Disclosure

Page 22: Delivering Responsibly

Page size● Desktop page size 2466 kB● Images 1504 kB 62%● Scripts 399 kB 16%● Video 294 kB 12%● CSS 75 kB 3%● Fonts 73 kB 3%● HTML 67 kB 3%● Other 11 kB <1%

Page 23: Delivering Responsibly

Page size past 5 years

5/2011 5/2012 5/2013 5/2014 5/2015 5/2016

Desktop 772 kB 1059 kB 1448 kB 1775 kB 2099 kB 2466 kB

Increase +37% +37% +23% +18% +17%

Mobile 377 kB 537 kB 752 kB 915 kB 1143 kB 1765 kB

Increase +42% +40% +22% +25% +54%

Page 24: Delivering Responsibly

Why do we care?● 50% of traffic is through mobile device● 80% of worldwide users on 3G or worse● 60% of US users 3G or worse● 50% of mobile device traffic is wifi

Page 25: Delivering Responsibly

Why do we care?

Page 26: Delivering Responsibly

Decreasing image load times● Use the right size images

Page 27: Delivering Responsibly

Decreasing image load times● TinyPNG, ImageOptim, 100 others● Data URI - 95.3%● SVG - 94.67%

Page 29: Delivering Responsibly

Decreasing image load times● Picture element - 63.29% - Demo

○ Browser chooses based on screen size

● Img with srcset - 66.09% - Demo○ Browser chooses best fit

Page 30: Delivering Responsibly

Decreasing CSS/JS load times● Minify● Concat● One http request● JS obfuscation

Page 31: Delivering Responsibly

Enable gzip/Brotli● Gzip - supported in all browsers● Brotli

○ 17-25% improvement○ 45.81% support 6.97% May 26th○ HTTPS only

Page 32: Delivering Responsibly

JavaScript Library Sizes

Development Minified gzip Savings

JQuery 1.11 276 kB 94 kB 33 kB 88.04%

Angular 1.2.15 729 kB 101 kB 37 kB 94.92%

Bootstrap 3.1.1 118 kB 98 kB 17 kB 85.59%

Foundation 5 186 kB 146 kB 18 kB 90.32%

Page 33: Delivering Responsibly

Page size with basic tips● Desktop page size 1250 kB● Images (60% savings) 602 kB 48% ● Scripts (-50%) 200 kB 16%● Video 294 kB 24%● CSS (-50%) 38 kB 3%● Fonts 73 kB 6%● HTML (-50%) 34 kB 3%● Other 11 kB <1%

Page 34: Delivering Responsibly

Browser Caching● Expire Headers● CSS● JavaScript● Images● Invalidate with new name

Page 35: Delivering Responsibly

HTTP/2● Faster on mobile● Works best from one host● Cheaper http requests● Binary● Multiplexed; eliminates blocking

Page 36: Delivering Responsibly

HTTP/2 Keep Doing● Optimize for size● Progressive enhancement● Eliminate unnecessary http requests

Page 37: Delivering Responsibly

HTTP/2 Stop Doing● Domain sharding● CSS sprites

Page 38: Delivering Responsibly

Testing● Browser tools

○ Disable JavaScript○ Slow connections○ Mobile emulator

● Real devices

Page 39: Delivering Responsibly

Questions?