EllisLab text mark
Advanced Search
     
cssmin: CSS Minification Library (ported from Minify)
Posted: 23 January 2009 11:44 AM   [ Ignore ]
Avatar
Joined: 2009-01-21
109 posts

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.

 Signature 

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

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

 
Posted: 28 January 2009 06:23 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

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

 Signature 

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

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

 
Posted: 28 January 2009 10:33 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

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.

 
Posted: 03 March 2012 01:34 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Joined: 2009-01-25
129 posts

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.

 
Posted: 21 May 2012 03:47 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2011-11-17
30 posts

no one download link do not work ( Please upload library

 
Posted: 21 May 2012 03:56 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Joined: 2011-09-18
61 posts

You can get it from github.