News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
How to Roll Your Own JavaScript Compressor with PHP and the Closure Compiler
August 31, 2010 @ 12:51:08

On the SitePoint PHP blog today there's a quick new post showing you how to create a Javascript compressor tool with PHP that uses the Closure Compiler from Google.

In my previous post, I discussed the Closure Compiler's REST API. In this article, we'll develop a small PHP program that shows how the API can be used to compress JavaScript code whenever you need it.

He shows how to compress three "script" tags down into one that defines multiple files for the engine to grab and compress. This is passed into a PHP file that grabs the file and passes the data off to the Closure Compiler for handling (via curl). The result is then passed back and served up with a content type of "text/javascript" back to the browser.

1 comment voice your opinion now!
closure compiler google javascript compress tutorial curl


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: Using the PEAR Pager Package to Paginate MySQL Results

Engine Yard Blog: Deploying PHP Applications on Engine Yard: A How-To

PHPBuilder.com: Using XML - A PHP Developer\'s Primer (Part 4) - XML-RPC, PHP and Javascript

PHPMaster.com: Deploy and Release your Applications with Phing

NETTUTS.com: Create a Slick Flickr Gallery with SimplePie


Community Events





Don't see your event here?
Let us know!


series opinion community threedevsandamaybe experience testing podcast configure install list language wordpress unittest developer interview framework laravel release code introduction

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework