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

[eluser]J. Brenne[/eluser]
In Windows you dont have to make your folder writable, its standard. Nope no errors, if I make the config "DEV" TRUE, it works cause it dont cache. So the paths are right, but it dont create a catch file. Very bad. Maybe a function in the script that doesnt supported by windows?
#12

[eluser]Johan André[/eluser]
I got this trouble:

I have a assets css folder at (siteroot)/assets/css/ with some base stylesheets.
My application uses different themes located in a subfolder (themes/).
All the different themefolders has it own (themespecific) images-folder.
The cache folder is located at (siteroot)/assets/cache/.

When using relative image-urls in my theme-stylesheet (images/somepic.jpg) AND using the cssmin-feature the image-url points to my assets/css/images/-folder instead of assets/css/themes/my_theme/images/.

The problem is how cssmin handles the relative urls.

Anyone got the same trouble?
#13

[eluser]tonydewan[/eluser]
@Brenne That's really hard for me to say. When I said the path might be incorrect, I was referring to the caching mechanism. So, the fact that it's loading the scripts correctly doesn't necessarily mean the cache path is correct.

Can you tell me more about the environment? Are you running Apache or IIS? PHP 4 or 5?

The fact that PHP isn't throwing any error confuses me...
#14

[eluser]tonydewan[/eluser]
@johan That's an interesting problem. If I understand you correctly, the _minify function in Carabiner needs a little bit of work.

Basically, you'll need to parse the $file_ref variable to get just the path info (so, remove the filename), and append it in the config call. The relevant part of _minify in carabiner.php would look something like this:

Code:
case 'css':
    $this->CI->load->library('cssmin');

    $rel = dirname($file_ref); // i added this line

    $this->CI->cssmin->config(array('relativePath'=>$this->style_uri . $rel)); // this line changed
                
    $contents = file_get_contents( realpath($this->style_path.$file_ref) );
    return $this->CI->cssmin->minify($contents);
            
break;

Note that I haven't tested that! I definitely will do so, and plan on including a fix like this in the library. Check back soon.

@johan If this works for you, or you come up with a better solution, let me know!
#15

[eluser]J. Brenne[/eluser]
@tonydewan

I use php5 on apache (newst xampp apachefriends.org). The cache path is 100% correct. Maybe I forgot somthing?
There is no errors or somthing, like I said - file dont get created.
Do not know why.

That you belive me: http://screencast.com/t/zsXdt7sVr
#16

[eluser]Johan André[/eluser]
Quote:@johan If this works for you, or you come up with a better solution, let me know!

Thanks for your reply! I did not work for me though.
I did this:

Code:
case 'css':
            
    $this->CI->load->library('cssmin');
    $relative_path = base_url() . $this->style_uri . substr($file_ref, 0, - strlen(basename($file_ref)));
    $this->CI->cssmin->config(array('relativePath'=> $relative_path));
                
    $contents = file_get_contents( realpath($this->style_path.$file_ref) );
    return $this->CI->cssmin->minify($contents);

break;

It converts all urls to absolute, based on base_url()

EDIT:
After some more testing it appears that linked stylesheets (using @import inside a loaded stylesheet) gets the urls wrong. Why is pretty obvious... I'll think of a fix. Maybe parse @import-statements and include them in the minified version?
#17

[eluser]tonydewan[/eluser]
@johan Glad you got it to work. I look forward to seeing your solution for the @import problem.

@Brenne I believe you! I'll look into it more this week.
#18

[eluser]umefarooq[/eluser]
hi it tried Carabiner 1.2 for js files its not creating cache file in cache folder it giving file not found error, but with Carabiner 1.0 its working file. please can you check what's the problem in it.

here is my config
Code:
$carabiner_config = array(
            'script_dir' => 'admin/js/',
            'style_dir'  => 'css/',
            'cache_dir'  => 'assets/cache/',
            'base_uri'   => $base,
            'combine'    => TRUE,
            'dev'        => FALSE,
            'minify_js'  => TRUE,
            'minify_css' => TRUE
        );
#19

[eluser]12vunion[/eluser]
If I could make a suggestion: you need to put a charset="utf-8" in the outputted script and style tags. Or grab the character encoding from the config. I had a problem with IE dying on my js after it was minified because of some weird characters getting thrown in. After changing the _tag function to output the charset, everything was peachy again.
#20

[eluser]J. Brenne[/eluser]
[quote author="umefarooq" date="1235619992"]hi it tried Carabiner 1.2 for js files its not creating cache file in cache folder it giving file not found error, but with Carabiner 1.0 its working file. please can you check what's the problem in it.[/quote]

I also tested it in Version 1.0 and works now fine for me. Maybe you look up your changes Wink




Theme © iAndrew 2016 - Forum software by © MyBB