ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Carabiner 1.4: Asset Management Library

June 01, 2009 3:30pm

Subscribe [76]
  • #1 / Jun 01, 2009 3:30pm

    tonydewan

    100 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', 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.

  • #2 / Jun 02, 2009 1:13am

    AnimeCYC

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

  • #3 / Jun 02, 2009 11:20am

    tonydewan

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

  • #4 / Jun 02, 2009 11:28am

    AnimeCYC

    11 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…

  • #5 / Jun 02, 2009 11:32am

    tonydewan

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

  • #6 / Jun 02, 2009 11:34am

    AnimeCYC

    11 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…

  • #7 / Jun 02, 2009 11:56am

    tonydewan

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

  • #8 / Jun 02, 2009 12:03pm

    AnimeCYC

    11 posts

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

  • #9 / Jun 04, 2009 7:35pm

    fxdc

    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 😊 ), 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 😊

  • #10 / Jun 04, 2009 8:59pm

    tonydewan

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

  • #11 / Jun 04, 2009 9:31pm

    tonydewan

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

  • #12 / Jun 10, 2009 7:39am

    garymardell

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

  • #13 / Jun 10, 2009 8:54am

    tonydewan

    100 posts

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

  • #14 / Jun 15, 2009 7:26am

    umefarooq

    690 posts

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

  • #15 / Jun 15, 2009 7:36am

    umefarooq

    690 posts

    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.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases