[eluser]ainstushar[/eluser]
Hi there, thanks for the amazing library. I think it's excellent
(I am new at CI, so bear with me if I say something stupid.)
Your library looks for all of the css files in a css folder, so if you want to load a css file that is outside of your style_uri, then you are in bad luck.
Script folder: /assets/css
Want to include: /assets/js/asdf/asdf.css (the css is part of a js framework, so it's better if that css stays in that folder)
I got around this problem by changing how the $dir variable is created.
Code:
private function _tag($flag, $ref, $cache = FALSE, $media = 'screen')
{
switch($flag){
case 'css':
// Detect '/' at the beginning
(strpos($ref, '/') === 0) ? ($dir = ( $this->isURL($ref) ) ? '' : ( ($cache) ? $this->cache_uri : $this->style_uri )) : $dir = '';
return '<link type="text/css" rel="stylesheet" href="'.$dir.$ref.'" media="'.$media.'" />'."\r\n";
break;
case 'js':
// Detect '/' at the beginning
(strpos($ref, '/') === 0) ? ($dir = ( $this->isURL($ref) ) ? '' : ( ($cache) ? $this->cache_uri : $this->script_uri )) : $dir = '';
return '[removed]CI->config->item('charset').'">[removed]'."\r\n";
break;
}
}
You see, my addition looks for '/' at the beginning of the path. If it finds it, then it won't append the style_uri. That way, if I want to include a that css, I would just type in
Code:
$this->carabiner->css('/assets/js/asdf/asdf.css');
I think that addition gives the developers more flexibility and gives this library 1 more feature.
Then again, I could be way off since I am just starting out with CI.
What do you think? And btw, that change works with including javascript files that are not in script_uri folder.
I hope that you can incorporate my changes in the next version.
Thanks.