UPDATE: For those that downloaded 1.4, 1.41, 1.42, 1.43 you can now grab the new 1.45 zip. 1.42 includes only minor changes and use of more accurate FCPATH constant. 1.43 includes the css-only group bugfix mentioned below. 1.45 includes numerous bug fixes from this thread.
I’ve updated Carabiner to version 1.4. For a full list of features, see the wiki entry. Here is whats new:
Asset Grouping
Assets can now be grouped! Groups are displayed/combined separately from each other. They are defined like so:
// Define JS
$js = array(
array('prototype.js'),
array('scriptaculous.js')
);
// create group
$this->carabiner->group('prototaculous', array('js'=>$js) );
// an IE only group
$css = array('iefix.css');
$js = array('iefix.js');
$this->carabiner->group('iefix', array('js'=>$js, 'css'=>$js) );
// you can even assign an asset to a group individually
// by passing the group name to the last parameter of the css/js functions
$this->carabiner->css('spec.css', 'screen', 'spec-min.css', TRUE, FALSE, 'spec');To display a group, pass the group name to the display function:
// display group
$this->carabiner->display('jquery'); // group name defined as jqueryThis grouping functionality doesn’t break anything from before. You can update Carabiner and still use as you would have with previous versions.
Predefined Groups
The config file has been updated to include a whole slew of predefined groups. They are served from the Google Ajax Libraries API. Predefined groups include jQuery, jQuery UI, Prototype, script.aculo.us, Mootools, Dojo, SWFObject, YUI. They are automatically imported by the config method, so all you need to do to use them is display them in your views by the group name. For example:
$this->carabiner->display('jquery');
$this->carabiner->display('yui');
$this->carabiner->display('scriptaculous');If you don’t want them automatically loaded, just comment them out (or remove them) from the config file. Keep in mind that any groups defined in the config will be automatically added, so if you have a group that goes everywhere, you can put it there.
Date Parameter for empty_cache() method
You can now pass a string as the second parameter to the empty_cache() method to define the time before which all cache files will be removed. That is, any files created before that time will be removed. The string can be any string that PHP’s time() function can take.
At this point, I see Carabiner as feature complete. I will continue to support it and provide bug fixes, but I have no plans for more features. If you have things you want added to it, let me know. I’m open to new ideas.