Welcome Guest, Not a member yet? Register   Sign In
Carabiner 1.4: Asset Management Library
#1

[eluser]tonydewan[/eluser]
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:
Code:
// 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:
Code:
// 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:
Code:
$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

[eluser]AnimeCYC[/eluser]
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

[eluser]tonydewan[/eluser]
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

[eluser]AnimeCYC[/eluser]
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

[eluser]tonydewan[/eluser]
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

[eluser]AnimeCYC[/eluser]
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

[eluser]tonydewan[/eluser]
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

[eluser]AnimeCYC[/eluser]
Log threshold is set to 4, I have PMed you the log file and the aforementioned method.
#9

[eluser]Unknown[/eluser]
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 www.site.com/css, but when r/w by php its /home/public_html/css

If U see what I mean Smile
#10

[eluser]tonydewan[/eluser]
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.




Theme © iAndrew 2016 - Forum software by © MyBB