SlideShare uma empresa Scribd logo
1 de 36
Baixar para ler offline
CSS FILES OPTIMIZATION
                            TW 2011
                             Special lab

                            Bogdan Gaza




TW 2011                                    @hurrycane
Monday, February 21, 2011
$ whoami

                 Student at Faculty of Computer Science, Iasi, Romania


                            RubySOC 2010 student



                               bogdan.gaza@info.uaic.ro


                                @hurrycane

TW 2011                                                                  @hurrycane
Monday, February 21, 2011
Why optimize css?


TW 2011                                         @hurrycane
Monday, February 21, 2011
To load pages faster


TW 2011                                     @hurrycane
Monday, February 21, 2011
The BIGGER the website - the
                bigger the file size



TW 2011                             @hurrycane
Monday, February 21, 2011
The BIGGER the website - the
               selectors get larger



TW 2011                             @hurrycane
Monday, February 21, 2011
http://special-web.wikispaces.com/Presentations




TW 2011                                                              @hurrycane
Monday, February 21, 2011
http://special-web.wikispaces.com/Presentations

                                             Load time




TW 2011                                                              @hurrycane
Monday, February 21, 2011
http://special-web.wikispaces.com/Presentations




                            Size


TW 2011                                                              @hurrycane
Monday, February 21, 2011
http://www.trilulilu.ro

                                                  Load time




                            Size


TW 2011                                                       @hurrycane
Monday, February 21, 2011
21% of Top 1000 Alexa* have
                  >100k of CSS


                              *Alexa = internet traffic stats

TW 2011                                            @hurrycane
Monday, February 21, 2011
How?


TW 2011                            @hurrycane
Monday, February 21, 2011
Reduce file size
                                  GZIP

                            Number of css files

                                  Minify

                               Reuse code

                             Smaller selectors


TW 2011                                          @hurrycane
Monday, February 21, 2011
Reduce file size
                                     GZIP




                            Client            Server




TW 2011                                                @hurrycane
Monday, February 21, 2011
Reduce file size
                                     GZIP


                                     Request
                            Client             Server




TW 2011                                                 @hurrycane
Monday, February 21, 2011
Reduce file size
                                     GZIP


                                     Request
                            Client              Server
                                     Response




TW 2011                                                  @hurrycane
Monday, February 21, 2011
Reduce file size
                                     GZIP


                                     Request
                            Client              Server
                                     Response
                                       gzip




TW 2011                                                  @hurrycane
Monday, February 21, 2011
Reduce file size - gzip
                             Important bandwidth reduction
                                        example

                                      Amazon EC2
                                 1 TB (uncompressed) = $174
                                1 TB (compressed) = $43.52




TW 2011                                                       @hurrycane
Monday, February 21, 2011
Reduce file size - gzip
                             Important bandwidth reduction
                                        example

                                      Amazon EC2
                                 1 TB (uncompressed) = $174
                                                                 4:1
                                                              compression
                                1 TB (compressed) = $43.52




TW 2011                                                                     @hurrycane
Monday, February 21, 2011
gzip
                            mod_delate
                              Demo


TW 2011                                         @hurrycane
Monday, February 21, 2011
Reduce file size
                                  GZIP

                            Number of css files

                                  Minify

                               Reuse code

                             Smaller selectors


TW 2011                                          @hurrycane
Monday, February 21, 2011
Reduce file size
                                  GZIP

                            Number of css files

                                 Minify

                               Reuse code

                             Smaller selectors


TW 2011                                          @hurrycane
Monday, February 21, 2011
Reduce file size


    Minification = remove unnecessary characters from code
                 without changing functionality




TW 2011                                             @hurrycane
Monday, February 21, 2011
Reduce file size

                            Minification is done using different tools.


                                        YUI-Compressor
                                            Minify
                                  Closure Compiler (google)



TW 2011                                                                  @hurrycane
Monday, February 21, 2011
Reduce file size

          YUI-Compressor is used for both JavaScript and CSS

                                       Written in Java

                                     Command line tool

                            yuicompressor ceva.css -o ceva.min.css


TW 2011                                                              @hurrycane
Monday, February 21, 2011
YUI-Compressor
                                Demo


TW 2011                                      @hurrycane
Monday, February 21, 2011
Reduce file size
                                  GZIP

                            Number of css files

                                  Minify

                               Reuse code

                             Smaller selectors


TW 2011                                          @hurrycane
Monday, February 21, 2011
Reduce rendering time



TW 2011                                             @hurrycane
Monday, February 21, 2011
Paradigm shift

                            ul { ... }
                            ul li { ... }
                            ul li a { ... }



                                      Until now, focus was here


TW 2011                                                    @hurrycane
Monday, February 21, 2011
Paradigm shift

                            ul { ... }
                            ul li { ... }
                            ul li a { ... }


          Arhitecture lives here


TW 2011                                       @hurrycane
Monday, February 21, 2011
Object oriented css
                                Objects rather than pages
                                      Global defaults

                                Abstract reusable elements

                                Separate structure and skin

                            Use multiple classes to simulate OO


TW 2011                                                           @hurrycane
Monday, February 21, 2011
Example of optimisation:
                            Facebook’s Big pipe




TW 2011                                                @hurrycane
Monday, February 21, 2011
Example of optimisation:
                            Facebook’s Big pipe

                            50%
                                             improvement
                                             gain in loading
                                             speed



TW 2011                                                        @hurrycane
Monday, February 21, 2011
Choose the solution that best fits you!

TW 2011                                                              @hurrycane
Monday, February 21, 2011
QA

TW 2011                          @hurrycane
Monday, February 21, 2011
Thanks!



TW 2011                               @hurrycane
Monday, February 21, 2011

Mais conteúdo relacionado

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

[TW] CSS Files Optimization

  • 1. CSS FILES OPTIMIZATION TW 2011 Special lab Bogdan Gaza TW 2011 @hurrycane Monday, February 21, 2011
  • 2. $ whoami Student at Faculty of Computer Science, Iasi, Romania RubySOC 2010 student bogdan.gaza@info.uaic.ro @hurrycane TW 2011 @hurrycane Monday, February 21, 2011
  • 3. Why optimize css? TW 2011 @hurrycane Monday, February 21, 2011
  • 4. To load pages faster TW 2011 @hurrycane Monday, February 21, 2011
  • 5. The BIGGER the website - the bigger the file size TW 2011 @hurrycane Monday, February 21, 2011
  • 6. The BIGGER the website - the selectors get larger TW 2011 @hurrycane Monday, February 21, 2011
  • 7. http://special-web.wikispaces.com/Presentations TW 2011 @hurrycane Monday, February 21, 2011
  • 8. http://special-web.wikispaces.com/Presentations Load time TW 2011 @hurrycane Monday, February 21, 2011
  • 9. http://special-web.wikispaces.com/Presentations Size TW 2011 @hurrycane Monday, February 21, 2011
  • 10. http://www.trilulilu.ro Load time Size TW 2011 @hurrycane Monday, February 21, 2011
  • 11. 21% of Top 1000 Alexa* have >100k of CSS *Alexa = internet traffic stats TW 2011 @hurrycane Monday, February 21, 2011
  • 12. How? TW 2011 @hurrycane Monday, February 21, 2011
  • 13. Reduce file size GZIP Number of css files Minify Reuse code Smaller selectors TW 2011 @hurrycane Monday, February 21, 2011
  • 14. Reduce file size GZIP Client Server TW 2011 @hurrycane Monday, February 21, 2011
  • 15. Reduce file size GZIP Request Client Server TW 2011 @hurrycane Monday, February 21, 2011
  • 16. Reduce file size GZIP Request Client Server Response TW 2011 @hurrycane Monday, February 21, 2011
  • 17. Reduce file size GZIP Request Client Server Response gzip TW 2011 @hurrycane Monday, February 21, 2011
  • 18. Reduce file size - gzip Important bandwidth reduction example Amazon EC2 1 TB (uncompressed) = $174 1 TB (compressed) = $43.52 TW 2011 @hurrycane Monday, February 21, 2011
  • 19. Reduce file size - gzip Important bandwidth reduction example Amazon EC2 1 TB (uncompressed) = $174 4:1 compression 1 TB (compressed) = $43.52 TW 2011 @hurrycane Monday, February 21, 2011
  • 20. gzip mod_delate Demo TW 2011 @hurrycane Monday, February 21, 2011
  • 21. Reduce file size GZIP Number of css files Minify Reuse code Smaller selectors TW 2011 @hurrycane Monday, February 21, 2011
  • 22. Reduce file size GZIP Number of css files Minify Reuse code Smaller selectors TW 2011 @hurrycane Monday, February 21, 2011
  • 23. Reduce file size Minification = remove unnecessary characters from code without changing functionality TW 2011 @hurrycane Monday, February 21, 2011
  • 24. Reduce file size Minification is done using different tools. YUI-Compressor Minify Closure Compiler (google) TW 2011 @hurrycane Monday, February 21, 2011
  • 25. Reduce file size YUI-Compressor is used for both JavaScript and CSS Written in Java Command line tool yuicompressor ceva.css -o ceva.min.css TW 2011 @hurrycane Monday, February 21, 2011
  • 26. YUI-Compressor Demo TW 2011 @hurrycane Monday, February 21, 2011
  • 27. Reduce file size GZIP Number of css files Minify Reuse code Smaller selectors TW 2011 @hurrycane Monday, February 21, 2011
  • 28. Reduce rendering time TW 2011 @hurrycane Monday, February 21, 2011
  • 29. Paradigm shift ul { ... } ul li { ... } ul li a { ... } Until now, focus was here TW 2011 @hurrycane Monday, February 21, 2011
  • 30. Paradigm shift ul { ... } ul li { ... } ul li a { ... } Arhitecture lives here TW 2011 @hurrycane Monday, February 21, 2011
  • 31. Object oriented css Objects rather than pages Global defaults Abstract reusable elements Separate structure and skin Use multiple classes to simulate OO TW 2011 @hurrycane Monday, February 21, 2011
  • 32. Example of optimisation: Facebook’s Big pipe TW 2011 @hurrycane Monday, February 21, 2011
  • 33. Example of optimisation: Facebook’s Big pipe 50% improvement gain in loading speed TW 2011 @hurrycane Monday, February 21, 2011
  • 34. Choose the solution that best fits you! TW 2011 @hurrycane Monday, February 21, 2011
  • 35. QA TW 2011 @hurrycane Monday, February 21, 2011
  • 36. Thanks! TW 2011 @hurrycane Monday, February 21, 2011