PHP CSS Compressor
Written on Tuesday August 5th 2008 at 8:03 am

Compressing CSS is a great way to save some bandwidth, especially on more complex sites with stylesheets reaching more than 1000 lines of code. There are many websites out there that will compress your stylesheets for you, but the problem is maintaining them afterwards. Either search through a cryptic block of code, or keep backups and recompress after every change. While you might save file size, you'll probably lose development time.
With this CSS compressor, you upload and edit your stylesheet as you usually would. The compressor opens the stylesheet, compresses it, then outputs it to a compressed version.
How to use it:
First, download this package: php_css_compress_0_2_1.zip
Second, use this code to include the stylesheet in your <head> tag:
<link rel="stylesheet" href="css_compress.php?stylesheet=mystylesheet.css" type="text/css" />
Change mystylesheet.css to the desired stylesheet you wish to use. The compressor is directory relative, so if your stylesheet is in a different directory you can change mystylesheet.css to styles/mystylesheet.css or however you see fit.Cheers!
2 Comments
On Tuesday August 5th 2008 at 9:48 pm Guest said
what version of php does this work with?
Guest
![]()
On Friday August 8th 2008 at 7:14 pm Guest said
Works pretty good except the php file itself is 4kb, good for big style sheets though.
Add a comment or Login
Recent Blog Posts
- Join me on Blog Action Day to end Poverty
- PHP CSS Compressor
- Jack Nicholson was pushing for hydrogen cars in the 70s
- Bill Gates Retires Today
- New Weezer Video!
- Homer Simpson Written in CSS
- Dr. Martin Luther King Jr.
- Digg Justice / Xbox Moron
- Microsoft + Open Source ??
- New Facebook Application
Guest