Carabiner 1.4: Asset Management Library |
[eluser]tonydewan[/eluser]
I don't really think batch scripts are necessary. You should be able to do it without that. The thing that I think might be hard about abstracting the CDN connection is that the authentication schemes might not always be the same. Unfortunately, I don't know enough about different CDNs. Then again, the simpler (and perhaps better) solution would be to just bake CloudFront support right in, and then add others later... I'll think more about this and do some research. In the meantime, I'd love to see what you come up with!
[eluser]quasiperfect[/eluser]
hi i tried to use u'r lib but i have some problems i use ci on windows using wamp so i have c:\wamp\www as web folder i made a alias so now my app is installed like this Code: c:\wamp\app\ with url http://localhost/app/ and it works ok i took out the application folder from system and moved system out of app folder and changed in index.php $system_folder = "../system"; so now i have c:\wamp\system c:\wamp\app\application c:\wamp\app\cache c:\wamp\app\js c:\wamp\app\css in my .htaccess i have Code: Options +FollowSymLinks in carabiner conf i have folders defined like this $config['cache_dir'] = 'cache/'; when i load a js it tries to write it to C:\wamp\cache\ but it should be c:\wamp\app\cache\ any sugestion ?
[eluser]topherdan1[/eluser]
I think I have Amazon S3/CDN integration with Caribinner working pretty well now. Here are the steps I took: 1. Add an S3 library to your application/libraries folder. I used the one available here: http://undesigned.org.za/2007/10/22/amazon-s3-php-class and then customized it so that it pulled the variables from my config file. The only thing I changed in the S3.php file (which is the one to add to application/libraries) was the __construct on line 57 so that it looked like this: Code: public function __construct($accessKey = null, $secretKey = null, $useSSL = true) { 2. Next, update the carabiner config file with the following variables Code: $config['key_id'] = 'XXXXXXXX'; //Your Amazon key_id 3. Finally, modify the carabiner library in two spots: The _cache function should look like this: Code: private function _cache($filename, $file_data) Code: private function _tag($flag, $ref, $cache = FALSE, $media = 'screen') That should be it. Now when you are in a production environment, anytime a new cache file is created it will automatically be loaded into Amazon S3, which can act as a CDN. Then, on the site, the files use the CDN domain instead of the normal domain. Let me know if you have suggestions on how to improve this.
[eluser]quasiperfect[/eluser]
solved my problem i modified the lib changed dirname(FCPATH) to just FCPATH
[eluser]tonydewan[/eluser]
@quasiperfect I'm glad you got it to work. @topherdan1 That looks like a really solid solution! There are a few things you could change to make the code a little simpler: First, you can just do Code: if($this->use_cdn && !$this->dev) instead of Code: if($this->CI->config->item('use_cdn') === TRUE && $this->dev == FALSE) That's because the config function is lazy, and will drink up whatever items are in the config file (or array) and make them class variables. That also applies to anyplace you use this syntax: Code: $this->CI->config->item('') The only other thing I would do is adjust the logging in the cache function, so it looks something like this: Code: private function _cache($filename, $file_data) These are all minor things, though.
[eluser]ntheorist[/eluser]
Just want to say great job on this lib. I've been toying around with building a library with the same basic functionality but this is working great for me so far (it's been an hour ) I only have 2 comments : 1) integration with tinyMCE seems sticky, i got it to work finally but i have it linking to the tiny_mce.js separately. I might be doing something else wrong, but i'll have to look in further. 2) if you could, allow for a return value on the display function, ie Code: $script_tag = $this->carabiner->display('js', TRUE); // return as string i build my page head through output buffering so the echo doesn't matter, but i think its more CI-view-esque to have that option. thx again! CC
[eluser]tonydewan[/eluser]
Thanks! I'm glad it's working for you. 1) I've had issues with other Rich Text Editors as well. Flagging the file(s) to not be combined (or minified, frankly) should solve the problem. Of course, this is less than ideal, but there's sufficient complexity in those tools that I've been willing to accept the trade-off between my time trying to troubleshoot and the extra few kb and http request. 2) That's an interesting idea. I'll keep it mind. In the short term, output buffering is the perfect solution.
[eluser]quasiperfect[/eluser]
+1 for "if you could, allow for a return value on the display function"
[eluser]Devon Lambert[/eluser]
Hi Tony, Great application and extension of these different libraries in such an efficient manner. I have gotten the library to work but I am wondering how one would go about dynamically adding a js file to the head of site, based on the controller/method being called? I tried exploring the new "groups" feature but this only seemed to add my new js file at the top of the other js files. In turn this seemed to break my site?
[eluser]tonydewan[/eluser]
@dnyce I'm glad you like it. Adding scripts to the head of your site is as easy as calling Code: $this->carabiner->display(); in your view. If that doesn't help, feel free to provide some code examples of what you're trying to do. You can post it here, or message me directly. Good Luck! |
Welcome Guest, Not a member yet? Register Sign In |