News Feed
Sections




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

LineshJose.com:
How To Create A Simple CSS Compressor Using PHP
June 06, 2012 @ 08:44:26

In this recent post to his blog Linesh Jose shows you how to create a simple PHP-based compressor for your CSS (using some string replacement methods and a regex or two).

CSS or Cascading Style Sheets is a language used to describe the presentation of a document written in a markup language. If you're developing a very complex design for your site, CSS scripts become very long, and takes too much time to load. But a compressed CSS script can help your website load faster and easily maintain its functionality. Here, I've created a very simple CSS compressor using PHP to compress or reduce CSS script size.

You can read through the example code and see how it all works or you can download the code and see a live demo of it in action. His script does the compression on the fly, but it's not a far stretch to get it set up as a part of a build to output to a file on deployment.

0 comments voice your opinion now!
css compress tutorial strreplace pregreplace


blog comments powered by Disqus

Similar Posts

Juan Treminio's Blog: Getting Started with Kohana 3 (series)

Wojciech Sznapka's Blog: Power of PHP streams decompress gz archives on the fly from remote server

ServerGrove Blog: Error "Cannot find module 'less'" with Symfony2, Assetic and Twitter Bootstrap

PHPBuilder.com: The ABC's of PHP Part 5 - Strings & Text

CodePoets.co.uk: How to use PHP and PEAR MDB2 (Tutorial)


Community Events





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


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

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