Jump to content

CSS and JAVASCRIPT gzip


Recommended Posts

It looks my web hosting company runs so many web sites on their server so my front end loads bloody slow. I still don't understand why my tamplate uses 5 individual jquary scripts. So many requests. Does anybody of you guys tried gzip-ing all css and java scripts. Any idea how to do it?

Thanks,

Peter

Link to comment
Share on other sites

It sounds like your template needs to be optimised. PrestaShop v1.4 adds code to the .htaccess file to GZIP HTML, CSS and Javascript. It also adds code to cache images, CSS and Javascript. Here's the code it adds:


   ExpiresActive On
   ExpiresByType image/gif "access plus 1 month"
   ExpiresByType image/jpeg "access plus 1 month"
   ExpiresByType image/png "access plus 1 month"
   ExpiresByType text/css "access plus 1 week"
   ExpiresByType text/javascript "access plus 1 week"
   ExpiresByType application/javascript "access plus 1 week"
   ExpiresByType application/x-javascript "access plus 1 week"
   ExpiresByType image/x-icon "access plus 1 year"


FileETag INode MTime Size

   AddOutputFilterByType DEFLATE text/html
   AddOutputFilterByType DEFLATE text/css
   AddOutputFilterByType DEFLATE text/javascript
   AddOutputFilterByType DEFLATE application/javascript
   AddOutputFilterByType DEFLATE application/x-javascript



Perhaps adding this to the bottom of your .htaccess file will help?

PrestaShop v1.4 also has a "Combine, Compress, Cache" option for CSS and Javascript, but that's not easy to add to earlier versions of PrestaShop.

Link to comment
Share on other sites

Hi Rocky!

could you explain me how is your code works??

what is access plus 1 monht/week?

I use 1.3.1.1 and I had to fight with my hosting comany to switch on the gzip mod on the server but they did it

and I put these code before in htaccess

 mod_gzip_on Yes
 mod_gzip_dechunk Yes
 mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
 mod_gzip_item_include handler ^cgi-script$
 mod_gzip_item_include mime ^text/.*
 mod_gzip_item_include mime ^application/x-javascript.*
 mod_gzip_item_exclude mime ^image/.*
 mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*



and I test my site in gidnetwork gziptest

but nothing happend, it was not zipped

and now I just put your code, and all is works fine with 85,1% compression

but I don't understand this code so please explain it in a few word please!!!

Thanks so mutch anyway....it works fine

Link to comment
Share on other sites

  • 2 months later...

You must do it all manually using online tools. I suggest waiting for PrestaShop v1.4 and using the automatic CCC in it. It's much easier. I'm using it on my new PrestaShop v1.4 website, which I'll make live once PrestaShop v1.4 final is released, and it works well. My website runs very fast with all the performance options enabled.

Link to comment
Share on other sites

  • 2 months later...

DATO,

I'm not sure if this will help or not, but I've done a couple of video tutorials (based on NethercottConstructions work) that I think might help you. The first video tutorial is on GZIP and can be found at http://www.prestatraining.com/gzip-compression-browser-caching/.

The second tutorial is on PrestaShop v1.4 performance settings and can be found at http://www.prestatraining.com/performance-settings-for-prestashop-version-1-4/. If you are going up upgrade to v1.4, this should be useful to you.

Link to comment
Share on other sites

×
×
  • Create New...