Part of the EllisLab Network
   
 
cssmin: CSS Minification Library (ported from Minify)
Posted: 23 January 2009 10:44 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  109
Joined  01-21-2009

Similar to the JSMin port I did, this is a CSS minification library ported from the awesome Minify App.  Basically, I took the Minify_CSS component class and added a simple wrapper class to make it play nice with CodeIgniter.

The library expects a string and returns a string.

You load the library as normal:

$this->load->library('cssmin'); 

Minify a string like so:

$this->cssmin->minifyfile_get_contents('styles.css'); 

There are two options:

preserveComments
Boolean flag for preserving comments.  Only comments starting with /*! are preserved. Defaults to true.

relativePath
String that will be prepended to all relative URIs in import/url declarations.  Defaults to null.

The options can either be set globally using the config function:

$cssmin_options = array(
      
'preserveComments'=> TRUE
      
'relativePath'=> 'http://www.example.com/styles/images/'
);

$this->cssmin->config($cssmin_options); 

Or on individual calls to the minify function:

$this->cssmin->minify$stringFALSE$path ); 

Global settings override settings in individual calls.

Note: just like the jsmin library, cssmin is PHP5.

File Attachments
cssmin.1.0.zip  (File Size: 6KB - Downloads: 533)
 Signature 

Do you use CSS or JavaScript? Carabiner makes your life easier.  I promise.

CI-Disqus makes playing with the Disqus API a snap.

Profile
 
 
Posted: 28 January 2009 05:23 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  109
Joined  01-21-2009

New version: nothing has really changed.  I just updated documentation to be more accurate, and added some notes on usage.

File Attachments
cssmin_1.1.zip  (File Size: 6KB - Downloads: 502)
 Signature 

Do you use CSS or JavaScript? Carabiner makes your life easier.  I promise.

CI-Disqus makes playing with the Disqus API a snap.

Profile
 
 
Posted: 28 January 2009 09:33 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  109
Joined  01-21-2009

I’ve used this library in a full fledged asset management library called Carabiner.  Check it out!

 Signature 

Do you use CSS or JavaScript? Carabiner makes your life easier.  I promise.

CI-Disqus makes playing with the Disqus API a snap.

Profile
 
 
Posted: 03 March 2012 12:34 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
RankRank
Total Posts:  118
Joined  01-25-2009

I know this is an old post but is his library still available as the link to the zip is no longer working?
Hoping to making use of carabiner.

Profile
 
 
Posted: 21 May 2012 02:47 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  30
Joined  11-17-2011

no one download link do not work ( Please upload library

Profile
 
 
Posted: 21 May 2012 02:56 PM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  20
Joined  09-18-2011

You can get it from github.

Profile