Part of the EllisLab Network
   
1 of 12
1
Carabiner 1.4: Asset Management Library
Posted: 01 June 2009 01:30 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  104
Joined  01-21-2009

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 jquery

This 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.

File Attachments
carabiner 1.42.zip  (File Size: 20KB - Downloads: 115)
carabiner 1.43.zip  (File Size: 20KB - Downloads: 334)
carabiner 1.45.zip  (File Size: 24KB - Downloads: 252)
 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: 01 June 2009 11:13 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  13
Joined  06-01-2009

Having some trouble. For some reason this wont work if I use the supplied config file, but works if I use the config method within the controller. Shed any light on this? I get a permission denied when using the config file.

Profile
 
 
Posted: 02 June 2009 09:20 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  104
Joined  01-21-2009

Are you manually loading the config file?  If the config file is present, Carabiner will autoload it.  Manually loading it could cause unexpected results.

 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: 02 June 2009 09:28 AM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  13
Joined  06-01-2009

No, I uploaded the config file but for some reason it doesn’t create the cache files nor does it write to it (being that the file does not exist). The only way I have been able to get this working 100% is to use the config() method in the controller. If you like I can post the controller method I am using to call Carabiner if it will help any…

Profile
 
 
Posted: 02 June 2009 09:32 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  104
Joined  01-21-2009

So, are cache files created when using the config method?  But then, when using the Config file, you get a permissions error?

If that’s the case, it almost sounds like maybe the paths in the config file aren’t correct.

 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: 02 June 2009 09:34 AM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  13
Joined  06-01-2009

That is correct. What’s odd is I have checked the paths and they are the same in the config file as they are when I use the config() method in the controller. It may be the wrong path but the documentation stated it was relative to the front controller (index.php) so it would be quite odd if that was the case…

Profile
 
 
Posted: 02 June 2009 09:56 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  104
Joined  01-21-2009

What is your log threshold set to?  Carabiner logs several ‘debug’ messages throughout the process, so it might be helpful to have a look at your log file.  If you set your log level to 2 or higher and recreate the errors, we should get more specifics about whats going wrong.  Feel free to PM me with an attached log file.  As you mentioned before, it certainly couldn’t hurt to see the method your calling Carabiner in either.

 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: 02 June 2009 10:03 AM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  13
Joined  06-01-2009

Log threshold is set to 4, I have PMed you the log file and the aforementioned method.

Profile
 
 
Posted: 04 June 2009 05:35 PM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  1
Joined  09-27-2008

Great software!

Have you thought about your use of BASEPATH around lines 295 & how this fits in with the documentation, which says ’ Relative to the CI front controller (index.php)’.

Unless I’ve missed something (not unusual smile ), using BASEPATH makes it relative to ci.system, not index.php. Remember some of us have ci.system & ci.application as sibs, not desc of public_html

Anyhow because of the way my directories are organised changing BASEPATH to FCPATH makes everything work wonderfully. Again I say…A great piece of software.

Regards

John

ps. The directory structure that gave me problems?

wwww.site.com/css
wwww.site.com/index.php
/home/public_html/css
/home/ci.system

what goes in the html has to be http://www.site.com/css, but when r/w by php its /home/public_html/css

If U see what I mean smile

Profile
 
 
Posted: 04 June 2009 06:59 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  104
Joined  01-21-2009

Thanks for the kind words!  I’m glad Carabiner is working for you.  Also, that’s a very good point about BASEPATH vs FCPATH.  I’ll make that fix and update the download.

 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: 04 June 2009 07:31 PM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  104
Joined  01-21-2009

I just updated the download to version 1.42, which includes the BASEPATH to FCPATH change mentioned by fxdc, as well as some updates to the method documentation.

 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
 
 
   
1 of 12
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 119966 Total Logged-in Users: 53
Total Topics: 126092 Total Anonymous Users: 2
Total Replies: 663287 Total Guests: 524
Total Posts: 789379    
Members ( View Memberlist )