Optimize your CSS and JS with CakePHP in minutes Optimize your CSS and JS with CakePHP in minutes

One of my first articles discussed YSlow.  An excellent Mozilla add-on to help you understand why your web page may be loading slowly.

In that article, I describe the importance of gzip, minify, and grouping your Javascript and CSS code into one file each.

Just recently I was surfing CakePHP's bakery and found a nice add-on to simplify the process and make it super easy.


The helper is called PHPSpeedy Helper.  It's quite simple to set up.  First you download PHPSpeedy and extract it to your vendors directly.

Next up you install the helper provided and update your app_controller.php to automatically include the helper each time.

Next time you load your web site (make sure debug mode is 0) PHPSpeedy will compile all of your Javascript and CSS into one file each and minify it for you.

The first time the page loads it will be a bit slow while it compiles and minifies, don't worry this is only a one time thing.  Next time it will be lightening fast.

View the full article from the bakery here:

http://bakery.cakephp.org/articles/view/phpspeedy-helper

* Please note: I did not build this helper, so if you require help, please comment in the Bakery to get the authors assistance.

Time to get back to developing!

Published on Mar 21, 2009

Tags: The Ultimate CSS Tutorial for Beginner Programmers | CakePHP Tutorial | Optimization | jsmin | phpspeedy | JavaScript

Related Posts

Did you enjoy this article? If you did here are some more articles that I thought you will enjoy as they are very similar to the article that you just finished reading.

Tutorials

Learn how to code in HTML, CSS, JavaScript, Python, Ruby, PHP, Java, C#, SQL, and more.

No matter the programming language you're looking to learn, I've hopefully compiled an incredible set of tutorials for you to learn; whether you are beginner or an expert, there is something for everyone to learn. Each topic I go in-depth and provide many examples throughout. I can't wait for you to dig in and improve your skillset with any of the tutorials below.