cakephp-shrink
cakephp-shrink copied to clipboard
ShrinkHelper.php path fix
$webCacheFilePath = $this->settings['url'] . preg_replace('//+/', '/', '/'. $this->extraPath .'/'. $this->settings[$type]['cachePath'] . $cacheFile); // line 181
i would change to
$webCacheFilePath = $this->settings['url'] . preg_replace('//+/', '/', '/'. $this->extraPath .'/'. $this->settings[$type]['cachePath'] . $cacheFile); $webCacheFilePath = $this->assetUrl($webCacheFilePath, array() + array('pathPrefix' => Configure::read('App.cssBaseUrl')));
Thanks for the tip @paleicikas . How will this affect existing deployments? I see using assetUrl would be more "cake like" and want to update the source, just curious if this required other changes in how you deployed?..
Hey @paleicikas after reviewing the code, it looks like this achieves the same as the settings allow via $settings['js']['path'] and $settings['js']['cachePath'](and same with css) plus the $settings['url']. I think what you're trying to do keeps more true to the cake core config, but considering there are now a few different files: css, js and cache css/js there are 4 possible paths depending on debug mode etc.. If anything the Configure::read('App.cssBaseUrl') or Configure::read('App.jsBaseUrl') could be used farther down at line 257. I will investigate farther.