EllisLab text mark
Advanced Search
1 of 14
1
   
Carabiner 1.4: Asset Management Library
Posted: 01 June 2009 03:30 PM   [ Ignore ]
Avatar
Joined: 2009-01-21
109 posts

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'TRUEFALSE'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.

 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: 02 June 2009 01:13 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2009-06-02
13 posts

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.

 
Posted: 02 June 2009 11:20 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

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.

 
Posted: 02 June 2009 11:28 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Joined: 2009-06-02
13 posts

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…

 
Posted: 02 June 2009 11:32 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

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.

 
Posted: 02 June 2009 11:34 AM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Joined: 2009-06-02
13 posts

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…

 
Posted: 02 June 2009 11:56 AM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

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.

 
Posted: 02 June 2009 12:03 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Joined: 2009-06-02
13 posts

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

 
Posted: 04 June 2009 07:35 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Joined: 2008-09-27
1 posts

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 w,hen r/w by php its /home/public_html/css

If U see what I mean smile

 
Posted: 04 June 2009 08:59 PM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

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.

 
Posted: 04 June 2009 09:31 PM   [ Ignore ]   [ # 10 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

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.

 
Posted: 10 June 2009 07:39 AM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Joined: 2007-04-05
320 posts

How hard would it be to include the script to minimize the files? I seem to prefer this library over assetlibpro but would like to be able to minify my files first. Gzip isn’t so important to me currently.

Edit: Oh wait i think i got the wrong end of the stick, it just doesnt use packer to make the js unreadable and doesn’t include gzip.

 
Posted: 10 June 2009 08:54 AM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Avatar
Joined: 2009-01-21
109 posts

That’s right.  It will minify JS using JSMin, it just won’t obfuscate using Packer.

 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: 15 June 2009 07:26 AM   [ Ignore ]   [ # 13 ]   [ Rating: 0 ]
Avatar
Joined: 2008-09-11
758 posts

can i use carabiner without config file like previous versions. well nice job i like this library from its first release.

 Signature 

CI,JQuery,Google Maps | widget with CI loader | Thumbnail, Image Resize, Image Crop Helper | CI shortcode

 
Posted: 15 June 2009 07:36 AM   [ Ignore ]   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2008-09-11
758 posts
umefarooq - 15 June 2009 11:26 AM

can i use carabiner without config file like previous versions. well nice job i like this library from its first release.

sorry i fond the solution its really amazing, again nice job.

 Signature 

CI,JQuery,Google Maps | widget with CI loader | Thumbnail, Image Resize, Image Crop Helper | CI shortcode

 
Posted: 19 June 2009 04:36 PM   [ Ignore ]   [ # 15 ]   [ Rating: 0 ]
Joined: 2009-03-14
14 posts

On line 654 in the carabiner class, I think that

if( !isset($this->js[$group]) ): 

should read:

if( !isset($this->css[$group]) ): 

Change ‘js’ to ‘css’

This helps fixed a bug for when you define a group that is only supposed to display CSS files.

 
1 of 14
1