Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17
  1. #11
    Join Date
    Jan 2011
    Location
    Adelaide, Australia
    Posts
    1,670
    Plugin Contributions
    1

    Default Re: Page Load Speed issues - Minify CSS, Compress Images, Render Blocking JavaScript,

    Quote Originally Posted by lat9 View Post
    Do you think that Image Handler will help?
    I was wondering the same thing - the images that are issues according to a number page speed tests are those that are integrally a part of the template, logos and the slider images - so I am not sure how to have IH4 handle those images - it appears that IH4 only handles product images??

    cheers,
    Mike

  2. #12
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: Page Load Speed issues - Minify CSS, Compress Images, Render Blocking JavaScript,

    Quote Originally Posted by shags38 View Post
    Many thanks for your reply Design75 - Guess who did exactly that soon after posting - was early in the morning, hadn't yet had my second cup of coffee so brain still wasn't engaged

    cheers,
    Mike
    Yeah, the answer may have been a bit lame, people tend to forget there is a big world with information outside this community.

  3. #13
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    red flag Re: Page Load Speed issues - Minify CSS, Compress Images, Render Blocking JavaScript,

    Quote Originally Posted by Design75 View Post
    Yeah, the answer may have been a bit lame, people tend to forget there is a big world with information outside this community.
    You can use async for javascripts and media="screen" for stylesheets

    It doesn't work for all of them but works for some. Also compressing all stylesheets into one doesn't always work due to the Zen Cart architecture.

    This is what I suggest:

    In templates/YOUR_TEMPLATE/common/html_header.php

    Look for where it links to your stylesheets

    For example:

    PHP Code:
    while(list ($key$value) = each($directory_array)) {    echo '<link rel="stylesheet" type="text/css" href="' $template->get_template_dir('.css',DIR_WS_TEMPLATE$current_page_base,'css') . '/' $value '" />'."\n";  } 
    and change it to:

    PHP Code:
    while(list ($key$value) = each($directory_array)) {    echo '<link media="screen" rel="stylesheet" type="text/css" href="' $template->get_template_dir('.css',DIR_WS_TEMPLATE$current_page_base,'css') . '/' $value '" />'."\n";  } 
    Note where it now says media="screen"

    There is one entry for mobiles which I changed too where the styles aren't required for desktops or laptops:

    PHP Code:
    $responsive_mobile '<link rel="stylesheet" type="text/css" href="' $template->get_template_dir('.css',DIR_WS_TEMPLATE$current_page_base,'css') . '/' 'responsive_mobile.css' '" 
    changed to

    PHP Code:
    $responsive_mobile '<link rel="stylesheet" type="text/css" href="' $template->get_template_dir('.css',DIR_WS_TEMPLATE$current_page_base,'css') . '/' 'responsive_mobile.css' '" media="(min-width: 53.333em)" 
    HTML Code:
    media="(min-width: 53.333em)"
    only renders the mobile stylesheet once the screensize reduces to 640px

    Javascript is slightly different.

    Look for where it says:

    HTML Code:
    <script type="text/javascript"
    and change it to:

    HTML Code:
    <script async type="text/javascript"
    I suggest testing as well, don't do this on a live site. AND BACKUP before you do the work. The results can be a little sketchy but you increase your page speed.

    I also added into htaccess:

    HTML Code:
    <IfModule mod_headers.c>      <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|svg)$">   Header set Cache-Control "max-age=84600, public"  </FilesMatch>  <FilesMatch "analytics\.(js)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "stylesheet\.(css)$">   Header set Cache-Control "max-age=604800"  </FilesMatch>  <FilesMatch "jquery.mmenu.min.all\.(js)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "responsive_mobile\.(css)$">   Header set Cache-Control "max-age=604800"  </FilesMatch>  <FilesMatch "jquery.mmenu.all\.(css)$">   Header set Cache-Control "max-age=604800"  </FilesMatch>  <FilesMatch "jquery.nivo.slider.pack\.(js)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "stylesheet_colors\.(css)$">   Header set Cache-Control "max-age=604800"  </FilesMatch>  <FilesMatch "jscript_imagehover\.(js)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "index_home\.(css)$">   Header set Cache-Control "max-age=604800"  </FilesMatch>  <FilesMatch "responsive\.(css)$">   Header set Cache-Control "max-age=604800"  </FilesMatch>  <FilesMatch "stylesheet_zen_colorbox\.(css)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "jscript_matchHeight-min\.(js)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "stylesheet_css_buttons\.(css)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "stylesheet_flexible_footer_menu\.(css)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "print_stylesheet\.(css)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "jquery.mmenu.fixedelements.min\.(js)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "style_imagehover\.(css)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch>  <FilesMatch "p\.(css)$">   Header set Cache-Control "max-age=31536000"  </FilesMatch></IfModule>
    And applied compression through CPANEL.

    All of these combined, took my page speed up from around between 50% - 60% up to 85% - 98%
    Last edited by Nick1973; 7 Aug 2019 at 01:55 PM.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  4. #14
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    Default Re: Page Load Speed issues - Minify CSS, Compress Images, Render Blocking JavaScript,

    I also optimised a secondary set of images with a .webp extension. You will need JPEGS and PNG's as well as a fallback for browsers that can't render .webp images.

    However to automate whether the browser sees the .webp image or the jpeg or png all you need to do is add:

    Code:
    <ifModule mod_rewrite.c>
      RewriteEngine On 
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{REQUEST_URI}  (?i)(.*)(\.jpe?g|\.png)$ 
      RewriteCond %{DOCUMENT_ROOT}%1.webp -f
      RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [L,T=image/webp,R] 
    </IfModule>
    to images/.htaccess

    and any other images directory (including sub directories) create a htaccess file with the above applied in it.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  5. #15
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    Default Re: Page Load Speed issues - Minify CSS, Compress Images, Render Blocking JavaScript,

    Quote Originally Posted by Nick1973 View Post
    I also optimised a secondary set of images with a .webp extension. You will need JPEGS and PNG's as well as a fallback for browsers that can't render .webp images.

    However to automate whether the browser sees the .webp image or the jpeg or png all you need to do is add:

    Code:
    <ifModule mod_rewrite.c>
      RewriteEngine On 
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{REQUEST_URI}  (?i)(.*)(\.jpe?g|\.png)$ 
      RewriteCond %{DOCUMENT_ROOT}%1.webp -f
      RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [L,T=image/webp,R] 
    </IfModule>
    to images/.htaccess

    and any other images directory (including sub directories) create a htaccess file with the above applied in it.
    Correction:

    Code:
    <ifModule mod_rewrite.c>
      RewriteEngine On 
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{REQUEST_URI}  (?i)(.*)(\.jpe?g|\.png)$ 
      RewriteCond %{DOCUMENT_ROOT}%1.webp -f
      RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [L,T=image/webp,R] 
    </IfModule>
    Should be

    Code:
    <ifModule mod_rewrite.c>
      RewriteEngine On 
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{REQUEST_URI}  (?i)(.*)(\.jpe?g|\.png)$ 
      RewriteCond %{DOCUMENT_ROOT}%1.webp -f
      RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [L,T=image/webp,R] 
    </IfModule>
    
    
    <IfModule mod_headers.c>
      Header append Vary Accept env=REDIRECT_accept
    </IfModule>
    
    
    AddType image/webp .webp
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  6. #16
    Join Date
    Feb 2009
    Location
    atlanta GA
    Posts
    278
    Plugin Contributions
    0

    Default Re: Page Load Speed issues - Minify CSS, Compress Images, Render Blocking JavaScript,

    Quote Originally Posted by Nick1973 View Post
    Correction:

    Code:
    <ifModule mod_rewrite.c>
      RewriteEngine On 
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{REQUEST_URI}  (?i)(.*)(\.jpe?g|\.png)$ 
      RewriteCond %{DOCUMENT_ROOT}%1.webp -f
      RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [L,T=image/webp,R] 
    </IfModule>
    Should be

    Code:
    <ifModule mod_rewrite.c>
      RewriteEngine On 
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{REQUEST_URI}  (?i)(.*)(\.jpe?g|\.png)$ 
      RewriteCond %{DOCUMENT_ROOT}%1.webp -f
      RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [L,T=image/webp,R] 
    </IfModule>
    
    
    <IfModule mod_headers.c>
      Header append Vary Accept env=REDIRECT_accept
    </IfModule>
    
    
    AddType image/webp .webp
    Will this work with 1.5.5f ? I am trying to improve my page load speed in google insight.

    Missingcord.com

  7. #17
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    Default Re: Page Load Speed issues - Minify CSS, Compress Images, Render Blocking JavaScript,

    It should do, I have improved the speed of some 1.5.5f sites using similar methods. It depends which template you are using.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. JavaScript and CSS issues
    By krastley in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 13 Apr 2011, 09:03 PM
  2. Should I compress my stylesheet.css
    By candylotus in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 15 Nov 2010, 04:24 PM
  3. Works great on host machine, but css/images don't load anywhere else...
    By bleudeciel16 in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 29 Jan 2010, 05:23 AM
  4. Firefox won't render the css
    By mikeylikesyou in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 27 Feb 2008, 06:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR