SlideShare a Scribd company logo
1 of 15
Download to read offline
Migliorare le
             performance Front-
             End con TYPO3
             David Denicolò <david@intera.it>




T3Camp Italia                                   Migliorare le performance Front-End
                                                Bologna 28/29 Ottobre 2011
L’evento italiano dedicato a TYPO3              David Denicolò - InteRa srl
About me




                 David Denicolò
                 CTO @ InteRa

                 TYPO3 dal 2002


T3Camp Italia                          Migliorare le performance Front-End
L’evento italiano dedicato a TYPO3     David Denicolò - InteRa srl
Le performance di un sito web sono
                             uno degli aspetti cruciali

                             raggiungere le migliori prestazioni
                             porta un vantaggio per gli utenti e
                             benefici per i motori di ricerca.


T3Camp Italia                                Migliorare le performance Front-End
L’evento italiano dedicato a TYPO3           David Denicolò - InteRa srl
Il tempo di caricamento delle pagine è
                          un elemento che condiziona il ranking.




T3Camp Italia                              Migliorare le performance Front-End
L’evento italiano dedicato a TYPO3         David Denicolò - InteRa srl
Da cosa è condizionato il tempo di
                             caricamento?
                             •       dalla risposta del server

                             •       dalle performance di TYPO3

                             •       dalla dimensione della pagina

                             •       dal numero di richieste HTTP


T3Camp Italia                                            Migliorare le performance Front-End
L’evento italiano dedicato a TYPO3                       David Denicolò - InteRa srl
Tecniche di ottimizzazione FE
                                                        riduce     diminuisce
          Tecnica
                                                    richieste HTTP dimensioni
  T       CSS3 ombre, gradienti, angoli                          V                         V
  E
  M       CSS Sprite
  P                                                              V                         =
  L       Font-face
  A                                                              V                     X       =
  T
  E       Distribuzione su più server                            V                         =
          Merge                                                  V                         =
                                                                                                   T
                                                                                                   Y
          Minify                                                 =                         V       P
          Compress                                               =                         V       O
          Source Optimization
T3Camp Italia
                                                                 =
                                                 Migliorare le performance Front-End
                                                                                           V       3
L’evento italiano dedicato a TYPO3               David Denicolò - InteRa srl
Distribuzione o parallelizzazione



                             La distribuzione è una tecnica mista, in
                             cui lo sviluppatore può disporre alcune
                             risorse su altro server.

                             L’estensione “T3 jQuery” permette
                             caricare librerie JavaScript jQuery
                             direttamente da un CDN, ad esempio
                             Google, MSN o jquerytools.com

T3Camp Italia                                      Migliorare le performance Front-End
L’evento italiano dedicato a TYPO3                 David Denicolò - InteRa srl
merge, minify, compress



                             le tecniche di Merge, Minify, Compress
                             su CSS e JS possono essere realizzate
                             tramite l’estensione di TYPO3:
                             •       “CSS/Javascript Minificator, Compressor”

                             •       extkey: scriptmerger

                             •       occorre configurare htaccess


T3Camp Italia                                           Migliorare le performance Front-End
L’evento italiano dedicato a TYPO3                      David Denicolò - InteRa srl
Esempio di TypoScript di scriptmerger

plugin.tx_scriptmerger {                      plugin.tx_scriptmerger {
        css {                                     javascript {
        enable = 1                                    enable = 1
        addContentInDocument = 0                      parseBody = 0
                                                      addBeforeBody = 0
              # minification                          doNotRemoveInDocInBody = 1
              minify {                                addContentInDocument = 0
                  enable = 1
                  ignore = .min.                          # minification
              }                                             minify {
                                                                enable = 1
              # gzip compression                                useJSMinPlus = 1
              compress {                                        ignore = ?,.min.
                  enable = 1                                }
                  ignore = .gz.
              }                                             # gzip compression
                                                            compress {
              # merging                                         enable = 1
              merge {                                           ignore = ?,.gz.
                  enable = 1                                }
                  ignore =
              }                                         # merging
                                                        merge {
              # charset                                     enable = 1
              uniqueCharset {                               ignore = ?
                  enable = 1                            }
                  value = @charset "UTF-8";         }
              }                                     externalFileCacheLifetime = 3600
      }                                       }
}
      
Esempio di htaccess di scriptmerger

### BEGIN EXT:scriptmerger ###

# Removal of ETag (saves some bytes; the last modified header is still there)
FileETag MTime Size
<IfModule mod_headers.c>
   FileETag none
</IfModule>
# Client caching of JS/CSS files (because they are merged with an applied hash!)
# Note: Unsetting of the last modified header causes a permant 200 Ok status
<FilesMatch ".(merge|min|gz)(.gz)?.(js|css)">
   <IfModule mod_expires.c>
       ExpiresActive on
       ExpiresDefault "access plus 1 year"
   </IfModule>

   <IfModule mod_headers.c>
       Header append Cache-Control "public"
   </IfModule>
</FilesMatch>
# deliver the uncompressed file if gzip encoding isn't accepted
AddEncoding x-gzip .gz
RewriteCond %{HTTP:accept-encoding} !gzip [NC]
RewriteRule ^typo3temp/scriptmerger/compressed/(.+).gz.(js|css)
typo3temp/scriptmerger/uncompressed/$1.$2 [L,NC]
### END EXT:scriptmerger ###
source optimization




                             la tecnica di source optimization
                             può essere realizzata tramite
                             l’estensione di TYPO3
                             •       “SourceOptimization”

                             •       extkey: sourceopt



T3Camp Italia                                            Migliorare le performance Front-End
L’evento italiano dedicato a TYPO3                       David Denicolò - InteRa srl
Esempio di TypoScript di sourceopt

# CONSTANTS

sourceopt {
  enabled = 1
  enable_utf-8_support = 1
  removeGenerator = 0
  removeBlurScript = 1
  removeComments = 1
  removeComments.keep.10 = /This website is powered by TYPO3/usi
  removeComments.keep.20 = /^[if/usi
  formatHtml = 1
  formatHtml.tabSize = 1
  formatHtml.debugComment = 1
}
Buone pratiche




                             CSS su file, non inline nel body

                             JS in header o footer non nel body

                             verificare CSS e JS delle estensioni

                             Redirect in htacces non in realurl


T3Camp Italia                                 Migliorare le performance Front-End
L’evento italiano dedicato a TYPO3            David Denicolò - InteRa srl
strumenti di verifica


                             Page speed
                             •       https://developers.google.com/pagespeed/

                             Tools Pingdom
                             •       http://fpt.pingdom.com/

                             Strumenti per webmaster di Google
                             •       https://www.google.com/webmasters/tools

T3Camp Italia                                           Migliorare le performance Front-End
L’evento italiano dedicato a TYPO3                      David Denicolò - InteRa srl
Grazie per l’attenzione
                          •      www.intera.it

                          •      twitter: davdenic

                          •      davdenic.tumblr.com




T3Camp Italia                                          TYPO3 Caretaker
L’evento italiano dedicato a TYPO3                     David Denicolò - InteRa srl

More Related Content

Similar to Migliorare le performance Frontend con TYPO3

Similar to Migliorare le performance Frontend con TYPO3 (7)

Design Patterns - Enterprise Patterns (part 2)
Design Patterns - Enterprise Patterns (part 2)Design Patterns - Enterprise Patterns (part 2)
Design Patterns - Enterprise Patterns (part 2)
 
L'analisi e le scelte nello sviluppo di un plugin
L'analisi e le scelte nello sviluppo di un pluginL'analisi e le scelte nello sviluppo di un plugin
L'analisi e le scelte nello sviluppo di un plugin
 
Layered Expression Trees feat. CQRS
Layered Expression Trees feat. CQRSLayered Expression Trees feat. CQRS
Layered Expression Trees feat. CQRS
 
Flavio ATZENI - SMAU 2014
Flavio ATZENI - SMAU 2014Flavio ATZENI - SMAU 2014
Flavio ATZENI - SMAU 2014
 
XPages Tips & Tricks, #dd13
XPages Tips & Tricks, #dd13XPages Tips & Tricks, #dd13
XPages Tips & Tricks, #dd13
 
Introduzione a Git
Introduzione a GitIntroduzione a Git
Introduzione a Git
 
TYPO3 Versione 10.2 - Le novita
TYPO3 Versione 10.2 - Le novitaTYPO3 Versione 10.2 - Le novita
TYPO3 Versione 10.2 - Le novita
 

Migliorare le performance Frontend con TYPO3

  • 1. Migliorare le performance Front- End con TYPO3 David Denicolò <david@intera.it> T3Camp Italia Migliorare le performance Front-End Bologna 28/29 Ottobre 2011 L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 2. About me David Denicolò CTO @ InteRa TYPO3 dal 2002 T3Camp Italia Migliorare le performance Front-End L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 3. Le performance di un sito web sono uno degli aspetti cruciali raggiungere le migliori prestazioni porta un vantaggio per gli utenti e benefici per i motori di ricerca. T3Camp Italia Migliorare le performance Front-End L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 4. Il tempo di caricamento delle pagine è un elemento che condiziona il ranking. T3Camp Italia Migliorare le performance Front-End L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 5. Da cosa è condizionato il tempo di caricamento? • dalla risposta del server • dalle performance di TYPO3 • dalla dimensione della pagina • dal numero di richieste HTTP T3Camp Italia Migliorare le performance Front-End L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 6. Tecniche di ottimizzazione FE riduce diminuisce Tecnica richieste HTTP dimensioni T CSS3 ombre, gradienti, angoli V V E M CSS Sprite P V = L Font-face A V X = T E Distribuzione su più server V = Merge V = T Y Minify = V P Compress = V O Source Optimization T3Camp Italia = Migliorare le performance Front-End V 3 L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 7. Distribuzione o parallelizzazione La distribuzione è una tecnica mista, in cui lo sviluppatore può disporre alcune risorse su altro server. L’estensione “T3 jQuery” permette caricare librerie JavaScript jQuery direttamente da un CDN, ad esempio Google, MSN o jquerytools.com T3Camp Italia Migliorare le performance Front-End L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 8. merge, minify, compress le tecniche di Merge, Minify, Compress su CSS e JS possono essere realizzate tramite l’estensione di TYPO3: • “CSS/Javascript Minificator, Compressor” • extkey: scriptmerger • occorre configurare htaccess T3Camp Italia Migliorare le performance Front-End L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 9. Esempio di TypoScript di scriptmerger plugin.tx_scriptmerger { plugin.tx_scriptmerger {         css {     javascript {         enable = 1         enable = 1         addContentInDocument = 0         parseBody = 0         addBeforeBody = 0         # minification         doNotRemoveInDocInBody = 1         minify {         addContentInDocument = 0             enable = 1             ignore = .min.         # minification         }         minify {             enable = 1         # gzip compression             useJSMinPlus = 1         compress {             ignore = ?,.min.             enable = 1         }             ignore = .gz.         }         # gzip compression         compress {         # merging             enable = 1         merge {             ignore = ?,.gz.             enable = 1         }             ignore =         }         # merging                  merge {         # charset             enable = 1         uniqueCharset {             ignore = ?             enable = 1         }             value = @charset "UTF-8";     }         }     externalFileCacheLifetime = 3600     } } }     
  • 10. Esempio di htaccess di scriptmerger ### BEGIN EXT:scriptmerger ### # Removal of ETag (saves some bytes; the last modified header is still there) FileETag MTime Size <IfModule mod_headers.c> FileETag none </IfModule> # Client caching of JS/CSS files (because they are merged with an applied hash!) # Note: Unsetting of the last modified header causes a permant 200 Ok status <FilesMatch ".(merge|min|gz)(.gz)?.(js|css)"> <IfModule mod_expires.c> ExpiresActive on ExpiresDefault "access plus 1 year" </IfModule> <IfModule mod_headers.c> Header append Cache-Control "public" </IfModule> </FilesMatch> # deliver the uncompressed file if gzip encoding isn't accepted AddEncoding x-gzip .gz RewriteCond %{HTTP:accept-encoding} !gzip [NC] RewriteRule ^typo3temp/scriptmerger/compressed/(.+).gz.(js|css) typo3temp/scriptmerger/uncompressed/$1.$2 [L,NC] ### END EXT:scriptmerger ###
  • 11. source optimization la tecnica di source optimization può essere realizzata tramite l’estensione di TYPO3 • “SourceOptimization” • extkey: sourceopt T3Camp Italia Migliorare le performance Front-End L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 12. Esempio di TypoScript di sourceopt # CONSTANTS sourceopt {   enabled = 1   enable_utf-8_support = 1   removeGenerator = 0   removeBlurScript = 1   removeComments = 1   removeComments.keep.10 = /This website is powered by TYPO3/usi   removeComments.keep.20 = /^[if/usi   formatHtml = 1   formatHtml.tabSize = 1   formatHtml.debugComment = 1 }
  • 13. Buone pratiche CSS su file, non inline nel body JS in header o footer non nel body verificare CSS e JS delle estensioni Redirect in htacces non in realurl T3Camp Italia Migliorare le performance Front-End L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 14. strumenti di verifica Page speed • https://developers.google.com/pagespeed/ Tools Pingdom • http://fpt.pingdom.com/ Strumenti per webmaster di Google • https://www.google.com/webmasters/tools T3Camp Italia Migliorare le performance Front-End L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl
  • 15. Grazie per l’attenzione • www.intera.it • twitter: davdenic • davdenic.tumblr.com T3Camp Italia TYPO3 Caretaker L’evento italiano dedicato a TYPO3 David Denicolò - InteRa srl

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n