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

[eluser]eedfwChris[/eluser]
[quote author="pickupman" date="1281027988"]
You can create the group in the config file just like the other predefined frameworks. Then call display('group').[/quote]

And that would "echo" the js/css code in the view which is useless. Or am I mistaken?

The idea here is to queue it so that you only have one display() in your layout/template/whatever.

Edit
One work around would be to pass the config variable back into the group() method (thus redefining the group).

Not sure if tony is still maintaining this library but I'd like to fork it and change it up a bit. The method names alone are confusing to me at least (group('group) should just queue a group and then maybe there should be something like a set_group() or add_group() method for manipulating groups or go the other way and have a use_group() method to queue the group for display()). Otherwise this is a great library.

[eluser]chefnelone[/eluser]
Hello,

The wiki says that base_uri is set by defaults to the CI config value for base_url.
But that is not working fine for me:

in application/config/config.php

Code:
$config['base_url'] = "http://190.169.3.33/mySite/";


It ONLY works fine if I do:

Code:
$carabiner_config = array(
    'script_dir' => 'mySite/assets/scripts/',
    'style_dir'  => 'mySite/assets/styles/',
    'cache_dir'  => 'mySite/assets/cache/',
    'base_uri'   => 'http://190.169.3.33/'
);                
$this->carabiner->config($carabiner_config);

...but I'like to remove 'mySite' from 'script_dir', 'style_dir' and 'cache_dir'. And remove base_uri from the array also

I tried with: (get a path error)
Code:
$carabiner_config = array(
    'script_dir' => 'assets/scripts/',
    'style_dir'  => 'assets/styles/',
    'cache_dir'  => 'assets/cache/',
    'base_uri'   => 'http://190.169.3.33/mySite/'
);                
$this->carabiner->config($carabiner_config);

... and also removing base_uri from the array (get a path error)
Code:
$carabiner_config = array(
    'script_dir' => 'assets/scripts/',
    'style_dir'  => 'assets/styles/',
    'cache_dir'  => 'assets/cache/'
);                
$this->carabiner->config($carabiner_config);


The path error says:

Message: file_put_contents(/Applications/MAMP/htdocs/assets/cache/0000000000d41d8cd98f00b204e9800998ecf8427e.js) [function.file-put-contents]: failed to open stream: No such file or directory
Filename: libraries/carabiner.php


anyone to help me??

[eluser]chefnelone[/eluser]
SOLVED updating to version 1.45
[quote author="chefnelone" date="1281103786"]Hello,

The wiki says that base_uri is set by defaults to the CI config value for base_url.
But that is not working fine for me:

in application/config/config.php

Code:
$config['base_url'] = "http://190.169.3.33/mySite/";


It ONLY works fine if I do:

Code:
$carabiner_config = array(
    'script_dir' => 'mySite/assets/scripts/',
    'style_dir'  => 'mySite/assets/styles/',
    'cache_dir'  => 'mySite/assets/cache/',
    'base_uri'   => 'http://190.169.3.33/'
);                
$this->carabiner->config($carabiner_config);

...but I'like to remove 'mySite' from 'script_dir', 'style_dir' and 'cache_dir'. And remove base_uri from the array also

I tried with: (get a path error)
Code:
$carabiner_config = array(
    'script_dir' => 'assets/scripts/',
    'style_dir'  => 'assets/styles/',
    'cache_dir'  => 'assets/cache/',
    'base_uri'   => 'http://190.169.3.33/mySite/'
);                
$this->carabiner->config($carabiner_config);

... and also removing base_uri from the array (get a path error)
Code:
$carabiner_config = array(
    'script_dir' => 'assets/scripts/',
    'style_dir'  => 'assets/styles/',
    'cache_dir'  => 'assets/cache/'
);                
$this->carabiner->config($carabiner_config);


The path error says:

Message: file_put_contents(/Applications/MAMP/htdocs/assets/cache/0000000000d41d8cd98f00b204e9800998ecf8427e.js) [function.file-put-contents]: failed to open stream: No such file or directory
Filename: libraries/carabiner.php


anyone to help me??[/quote]

[eluser]TigerWolf[/eluser]
I got this error when turning on Carabiner to production mode:

Code:
<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: Filename cannot be empty</p>
<p>Filename: libraries/carabiner.php</p>

<p>Line Number: 942</p>

Did I mess something up or is this a bug?

After refreshing the error goes away but then the site has two JS files from the cache folder in the top of the page and one of them is empty. If I comment out $this->carabiner->display(); then only one appears. I have not set any JS in the controller but want the ability to.

[eluser]TigerWolf[/eluser]
Is it possible to call a group from the config:
Quote:$this->carabiner->js('groupname');

Instead of:

Quote:$this->carabiner->display('groupname');

So that this can be called?

Quote:$this->carabiner->display();

[eluser]eedfwChris[/eluser]
[quote author="TigerWolf" date="1281421002"]Is it possible to call a group from the config:
Quote:$this->carabiner->js('groupname');

Instead of:

Quote:$this->carabiner->display('groupname');

So that this can be called?

Quote:$this->carabiner->display();
[/quote]

I've asked the same thing a few threads up. I haven't been able to find a way to do this. I even tried to load it from the config itself with not luck. I don't think it's possible so I stopped using groups for the most part.

[eluser]billdami[/eluser]
Sorry if this was already asked, but I am very interested in this library but I was wondering if it would handle loading of javascript that was actually contained in a .php view file and wrapped in script tags? Reason why I am doing this is that I have a localization library that gets the correct translation for a phrase/word from a database table based on the user's language preference. (i.e. alert('&lt;?=$this->localize->getline('some_text');?&gt;')Wink.

It would be awesome if Carabiner would run this script and then treat it as a normal JS file and perform the minification, caching ect.

[eluser]pickupman[/eluser]
What I do is treat all of files like jquery plugins and such to be handled by carabiner. Then for page specific js or php files I want to include, I use in my master view/template

Code:
//In master templat/view
if(isset($jquery)){
  echo $jquery;
}

//In controller
$data['jquery'] = $this->load->view('js_php_file.php', $data, TRUE); //return view and store in variable

$this->load->view('master_template', $data);

[eluser]tonydewan[/eluser]
Sorry if it seems like I've abandoned this thread. I haven't been getting notified about the replies. Sad

Let me first say: I haven't touched Carabiner in a long time. My life is pretty much all Ruby and JavaScript at this point, and I haven't used CI for some time. Having said that, I'm still more than happy provide support in these forums. Having said that, I still see Carabiner as pretty much feature complete. The last thing I wanted to add (support for adding "extensions" to Carabiner) has been completed and in the codebase (in the extend branch in GitHub) since November of last year. I haven't released it, as I haven't had the time or motivation to adequately test it. Anyone can feel free to clone, fork, test or submit code. I'd be happy to give anyone an overview of the current extension philosophy, though it should be pretty well commented in the code. I do still plan to get to it at some point, I just can't say when.

Now, I'll try to answer all the questions I missed from the past several months. Anything older than that is probably not worth answering.

@zombaya and @mikedfunk Those are solid additions. If you want, fork me on github and submit pull requests with the changes.

@vertmonkee Not with Carabiner. As mentioned, there are other ways.

@webPragmatist You had a bunch of questions that didn't really get answered. I'll answer them in reverse: First, feel free to fork: http://github.com/tonydewan/Carabiner. I'd be happy to still maintain the codebase if you want to submit Pull requests. In terms of "queueing" groups, I think what you want is the display_string method. It will return a string of the display result, rather than just echoing. The display method is meant to be used in views, which is why it works the way it does. display_string will allow you to call it in controllers and use the resulting string as you see fit. Third, your best bet is to use the parent folder as the config value, and just deal with longer paths.

@TigerWolf I'm not totally sure what you mean. Are you saying you want to add a group as an item in another group? If so, then no, that won't work.

@Bulletz I haven't ever tried this, but it should work. You might have issues with the caching conflicting with the internationalization output. However, as long as the "filenames" you reference are unique (for example "internationalize.php?lang=en" versus just "internationalize.php") it should work okay. You'll probably run into issues if the php files are running through the whole CI stack, rather than just bare php. Let us know if it works.

I hope that helps people. Thanks everyone for using Carabiner! I'm glad it's been useful.

[eluser]msteudel[/eluser]
One optimization that is often recommended is to load the css first, that way the user starts to see styles sooner making their user experience better. Looking at the way Carabiner loads in the jS and css it loads the css last, even if I declare it first. Any reasons on this? Note that I'm loading css first then js second, does it happen to load things in first in last out?




Theme © iAndrew 2016 - Forum software by © MyBB