A JavaScript packer like this would be a nice addition to carabiner !!!
http://dean.edwards.name/packer/
Or the php version:
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
June 01, 2009 3:30pm
Subscribe [76]#121 / Mar 28, 2010 4:02pm
A JavaScript packer like this would be a nice addition to carabiner !!!
http://dean.edwards.name/packer/
Or the php version:
#122 / Apr 21, 2010 4:48am
Hi,
Not exactly sure what I’m doing wrong here, but I can’t seem to separate out the js and the css. I have tried display(‘js’) and tried putting the files into separate groups, yet, for some reason, whichever i display first spits out both js and css. So if i would like to put the scripts at the bottom of the page (which i do) i’m out of luck. display(‘css’) gives both css and js, then echo a variable of $script at the bottom of the page gives an undefined variable.
from the controller:
$resources['css'] = $this->carabiner->display('css');
$resources['script'] = $this->carabiner->display('js');then in the view:
<?php echo $css; ?> gives CSS and JS
<?php echo $script; ?> $script is undefined variable.
I am using 1.42 because 1.45 wouldn’t work, possibly because i have am working on an older site and have not upgraded Codeigniter core yet.
Any ideas????
Thanks!! Awesome Lib!!!!!!!!!!!!!!
#123 / Apr 21, 2010 3:13pm
Hmm… figured it out.
apparently, passing the display() function into variables doesn’t work. If I had both display(‘css’) and display(‘js’) in the same controller, no matter if they were going into separate variables, both css and js would go into the first one.
BUT if the function is called in the view, there’s no problem.
Never mind!!!!
Really really really really really useful library!
THANK YOU!
#124 / Apr 22, 2010 12:06pm
Extending/adding assets -
Is it possible for a controller/module to add it’s own js/css with the asset library?
#125 / Apr 22, 2010 12:21pm
Yes, i’ve added assets in the controller before. Just do as you would in the view. $this->carabiner->js();
#126 / Apr 22, 2010 3:41pm
Thanks.
How does Carabiner differs from codeigniter-asset lib? (http://github.com/philsturgeon/codeigniter-asset)
#127 / Apr 22, 2010 4:47pm
Similar concept, however, carabiner is a little more powerful. It will combine and minify your js and css and cache them. Phil’s library just allows a cleaner way to add the url’s to your page.
#128 / Apr 22, 2010 4:58pm
More questions:
1. Doesn’t Carabiner handles image assets as well? (for easy printing of those)
2. If I also have assets like css/js and images not in the CI front controller directory but rather inside the application/modules or so, how is it possible to specify them and extends the css view within the controller that deals with those?
3. Doesn’t Carabiner support stylesheet’s syntax? such as, how would you specify (notice it’s the stylesheet alternative:
<link rel="stylesheet alternative" type="text/css" href="test.css" media="screen" title="Print Preview" />Thanks,
just trying to choose the right lib to use 😊
#129 / Apr 22, 2010 9:56pm
Only way to figure out the right one to use, is to try them. I am not of fan of putting stylesheets and scripts in the modules folder. Why not keep them in subfolders of the appropriate assets directory?
#130 / Apr 23, 2010 6:44am
Because one of the application’s goal is to be modular, so that modules can later be added (modules=controllers adding new pages to the application), and these may or may not require to add their own css/js/images
#131 / Apr 28, 2010 4:43am
Nice library so far but I have a problem and I would like to know if you have an idea for that:
Currently I get a URL like
<a href="http://domain/system/application/cache/carabiner/00000000009939b9184d06e0feb33450dc78b54e11.js">http://domain/system/application/cache/carabiner/00000000009939b9184d06e0feb33450dc78b54e11.js</a>Sure I do not allow direct access to my cache folder.
Now I was thinking to use a controller in the middle who can load the data and you would only reference this controller:
<a href="http://domain/Media/<group>">http://domain/Media/<group></a>;Is there a way to do it this way instead of giving access to my cache folder directly?
Thanks for ideas.
#132 / May 01, 2010 6:25pm
Hey there,
Just a quick note. On line 654 of the carabiner.php file
if( !isset($this->js[$group]) ):should be
if( !isset($this->css[$group]) ):Caused me a massive headache as adding groups in the config file wouldn’t work unless both a js and a css array were present. A lot of digging later, I found the problem.
Hope that helps people and the quick fix can be made to the latest version of Carabiner.
Many thanks for a great Library!
#133 / Jun 02, 2010 10:10am
So there may have already been a comment about this, and I didn’t see it, but I will say it anyway. Libraries need to have their file names capitalized and the class name should be capitalized as well. Not doing so will cause the script to fail on some machines that are case sensitive.
Read the User Manual
#134 / Jun 08, 2010 1:39pm
I’m having trouble every time carabiner combines files. It adds 2 weird characters between each combined file and makes the combined file fail. I’ve isolated the problem to combining; whether or not I minify has no effect. Strangely this only happens to my CSS files. My JS files also don’t work after combining but I can’t find out why. Here’s what the cached CSS file looks like:
Can anyone help??
#135 / Jun 17, 2010 11:39am
Great work! I used Carabiner in my current project (just implemented it) and had a huge performance gain because I now load javascripts on a per controller basis. I noticed however, that a faulty js cache file will always be included if I use $this->...->display() even if I did not add any js file anywhere. The file is not even there, Carabiner only pretends so. Maybe worth a fix.