12. 2-Before install a new add-on / lib
● It loads many scripts ?
● It increases the DB queries number ?
● It make calls to external APIs ?
● It makes complex operations ?
● Il explodes our web performance budget ?
@LoukilAymen
23. Solution : Switch between WEBP and classic formats
.htaccess
RewriteEngine On
RewriteBase /
# Le navigateur supporte il le WebP
RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
# Est ce PSI
RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
# Ce navigateur supporte le WebP
RewriteCond %{HTTP_ACCEPT} image/webp [OR]
# On a une version Webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
# On envoie l’image Webp
RewriteRule (.+).(?:jpe?g|png)$ $1.webp [NC,T=image/webp,E=webp,L]
Header append Vary Accept env=REDIRECT_webp
@LoukilAymen
28. 12-CSS - best practices
- Fewer lines is better !
- Minify the code (https://cssminifier.com/)
- don’t @import
- Delete unused code (Yeah man the old carousel..)
- No style in HTML tags
- Inline your critical CSS <style> … here </style>
- Preload the non critical CSS
<link rel=”preload” href=”non-critical-css.css” as=”style” onload=”this.rel=’stylesheet’” />
@LoukilAymen
36. Houston Airport and luggage delivery
1- Walk 1 minute and wait for 7 minutes => many customers claims
2- Take the elevator, walk for 6 minutes and wait for 2 minutes => 0 claims
@LoukilAymen