Top Banner
Web & Mobile optimization by Kirill Cebotari drupal.org @oresh
42
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Mobile and web optimization + Drupal

Web & Mobile optimization

by Kirill Cebotaridrupal.org @oresh

Page 2: Mobile and web optimization + Drupal

Content table

1. Why optimize?2. Javascript optimize.3. CSS optimization.4. Image optimization.5. Http requests.6. Drupal modules.7. Demo

Page 3: Mobile and web optimization + Drupal

Why optimize?

Page 4: Mobile and web optimization + Drupal

i can run 2.37 miles while i get to the contacts page

i'm still loading...

Page 5: Mobile and web optimization + Drupal

— No need to worry, just running by...

Page 6: Mobile and web optimization + Drupal
Page 7: Mobile and web optimization + Drupal

ok, open this page waiting... I'm hungry cook something for dinner meeh... I'm going to Mo's *going away

1 second is the focus time

Page 8: Mobile and web optimization + Drupal

Traffic can be expensive

Page 9: Mobile and web optimization + Drupal

Javascript optimization

Page 10: Mobile and web optimization + Drupal

It's 3.57 PetaFlops, Chubaka!

Page 11: Mobile and web optimization + Drupal
Page 12: Mobile and web optimization + Drupal

Make tests http://jsperf.com/math-floor-vs-math-round-vs-parseint/5

Page 14: Mobile and web optimization + Drupal

JSLint is a JavaScript program that looks for problems in JavaScript programs. It is a code quality tool. Like a Boss.

Use JSLint

Page 15: Mobile and web optimization + Drupal

http://tutorialzine.com/2013/04/50-amazing-jquery-plugins/

Keep experimenting.

Page 16: Mobile and web optimization + Drupal

CSS optimization

Page 17: Mobile and web optimization + Drupal

Use SMACSS or similar principles

chop chop chop chop...

Page 18: Mobile and web optimization + Drupal

Don't slow down your selectors

body div#content .content > div > div> ul.menu li[class~="item"] ul li

two more divs and I'm home...

Page 19: Mobile and web optimization + Drupal

CSS Selectors speed

I. ID ( #top )

II. Class ( .container )

III. Node/Element Type ( div )

IV. Sibling ( p + img )

V. Child ( ul > li )

VI. Descendant ( p strong )

VII. Universal ( * )

VIII. By Attribute ( [type="text"] )

IX. Pseudo Elements/Classes ( a:hover )

Page 20: Mobile and web optimization + Drupal

I. ID ( #top )

II. Class ( .container )

III. Node/Element Type ( div )

IV. Sibling ( p + img )

V. Child ( ul > li )

VI. Descendant ( p strong )

VII. Universal ( * )

VIII. By Attribute ( [type="text"] )

IX. Pseudo Elements/Classes ( a:hover )

Page 21: Mobile and web optimization + Drupal

Whyyyy so slow?!??!?!

Page 22: Mobile and web optimization + Drupal

Use SASS or LESS

Page 23: Mobile and web optimization + Drupal

Y U No let me use !important ?!

Page 24: Mobile and web optimization + Drupal

Image optimization

Page 25: Mobile and web optimization + Drupal

Image impact:

simple pagewith images

simple pagewithout images

optimized simple page

without images

Page 26: Mobile and web optimization + Drupal

5MB image on frontpage? Sure!

Page 27: Mobile and web optimization + Drupal

Use tiny png

*he'll eat out all your KBytes

Page 28: Mobile and web optimization + Drupal

Choose wisely

*http://luci.criosweb.ro/riot/

Page 30: Mobile and web optimization + Drupal

love sprites

Page 31: Mobile and web optimization + Drupal

Use CSS3 Gradients

*css

is a

wes

ome!

Page 32: Mobile and web optimization + Drupal

HTTP requests

Page 33: Mobile and web optimization + Drupal

IE 6/7: 2IE 8: 2 on dialup, 6 on broadbandIE 9: 6IE 10: 8Firefox: 6-8Safari: 4-6Chrome: 6-12

It really matters

Page 34: Mobile and web optimization + Drupal

Review your files

Page 36: Mobile and web optimization + Drupal

Drupal projects.

Page 37: Mobile and web optimization + Drupal

Break pointshttp://drupal.org/project/breakpoints

Page 38: Mobile and web optimization + Drupal

Responsive images

Page 39: Mobile and web optimization + Drupal

Responsive images and stylesproject:http://drupal.org/project/resp_img

video:http://modulesunraveled.com/responsive-images/part-1-installation

documentation:http://drupal.org/node/1904690

Page 40: Mobile and web optimization + Drupal

Simular projects1) Responsive Images - works as a field formatter - only supports 2 sizes2) Adaptive Image - works with screen size, not window size3) Adaptive Image Styles (ais) - needs .htaccess rules4) Client-side adaptive image - works as a field formatter5) Media: Responsive - works only on media field - set as maximum width - uses css for the smaller variants

Page 41: Mobile and web optimization + Drupal

Demo and browser tools.

Page 42: Mobile and web optimization + Drupal

Thank you!

Kirill Cebotaridrupal.org @oresh

irc: #drupal-mobile