how to compress the html/js/style files in codeigniter ??? |
[eluser]Spir[/eluser]
On my projects I usually make a sub domain for static content : js, css and images. I have something like this : /system /application /static → static content goes here (http://static.example.com) /www → index.php goes here (http://example.com) So I have 2 htaccess one for static content, another for www (my CI app) Here is an example of what I usually put in htacces for static content (could be better): Code: # Add deflate to static content http://code.google.com/p/minify It permits to minify my CSS and JS on the fly and cache the result so it will be quicker next time. Example : you have 4 js files : jquery-1.3.2.min.js jquery-ui-1.7.2.min.js jquery-ui-1.7.2.datepicker.min.js my_script.js You may have put all files in one JS file : great. But fomr some maintenance and reusage you may keep them in one file. This will result in calling 4 files like this : Code: type="text/javascript" src="http://static.example.com/js/jquery-1.3.2.min.js" Using that code (http://code.google.com/p/minify) you could dynamically minify them in one file like this : Code: type="text/javascript" src="http://static.example.com/min/?f=js/jquery-1.3.2.min.js,js/jquery-ui-1.7.2.min.js,js/jquery-ui-1.7.2.datepicker.min.js,js/my_script.js" Same goes for CSS. Here is what I have for my www/ folder : Code: <IfModule mod_rewrite.c> But you see my content delivered by my app do not use deflate. Before printing my <html> tag I put this : ob_start("ob_gzhandler"); and then right after my </head> tag I put this : ob_flush(); flush(); You can learn more about this there : http://www.phpied.com/progressive-render...e-flushes/ Now this is not all, I should also minify my html code. Here are some tips : http://maestric.com/doc/php/codeigniter_compress_html This few tasks will make your website quicker. |
Messages In This Thread |
how to compress the html/js/style files in codeigniter ??? - by El Forum - 09-07-2009, 12:36 AM
how to compress the html/js/style files in codeigniter ??? - by El Forum - 09-07-2009, 11:30 AM
how to compress the html/js/style files in codeigniter ??? - by El Forum - 09-07-2009, 11:36 AM
how to compress the html/js/style files in codeigniter ??? - by El Forum - 09-07-2009, 09:48 PM
how to compress the html/js/style files in codeigniter ??? - by El Forum - 09-07-2009, 11:07 PM
how to compress the html/js/style files in codeigniter ??? - by El Forum - 07-22-2010, 06:07 AM
|