edmundask / Sprinkle

Asset management library for CodeIgniter
http://edmundask.github.com/Sprinkle
22 stars 4 forks source link

asset combine and minify true or false file from cache #11

Open umefarooq opened 12 years ago

umefarooq commented 12 years ago

in assets definition i set combine and minify True and it making file in cache and taking file from cache but when set it false it still take file from cache directory not from is css or js directory

edmundask commented 12 years ago

I think I mentioned this somewhere in the wiki. Sometimes for new configuration changes to take effect you need to delete those cache files. It is not very neat and I'm aware of the problem. I'll look for a way to solve this when I have the time.

umefarooq commented 12 years ago

well thanks for quick reply, well in morning i was facing a problem i forget to put ending slash in assets location both js and css and it was not finding file where path become assets/cssbootstarp.css where it should be assets/css/bootstarp.css well i found on small solution will share and if you can add will be handy for new users of this library adding ending slash to asset location if missing you can find code here

http://www.jonasjohn.de/snippets/php/add-ending-slash.htm

_find_asset function will be like this.

private function _find_asset($asset_path = '') { foreach($this->_config['asset_locations'] as $loc) { $loc = $this->add_ending_slash($loc); $file_path = realpath($loc . $asset_path); if(file_exists($file_path)) return array('location' => $loc, 'file_path' => $file_path); } return FALSE; }