cakephp-shrink icon indicating copy to clipboard operation
cakephp-shrink copied to clipboard

ShrinkHelper.php path fix

Open paleicikas opened this issue 10 years ago • 2 comments

$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')));

paleicikas avatar Mar 14 '14 09:03 paleicikas

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?..

trentrichardson avatar Mar 14 '14 14:03 trentrichardson

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.

trentrichardson avatar Mar 18 '14 19:03 trentrichardson