Pagespeed caching css, annoying to develop

前端 未结 9 1994
耶瑟儿~
耶瑟儿~ 2020-12-29 23:45

I\'m working on a site which I havent coded from scratch and in firebug the css files are being displayed as: style.css.pagespeed.ce.5d2Z68nynm.css with the pagespeed extens

9条回答
  •  被撕碎了的回忆
    2020-12-30 00:26

    Just as an aside, on this old post, I wrote a PHP script to delete the contents of the pagespeed cache folders (which I placed within the var/www/html area) and added a button to the Magento admin cache control page to call it. This way, whenever the Magento cache needs clearing I can also hit the button to clear the pagespeed cache. The script can be IP and admin restricted. This saves a lot of messing about. You could use a recursive delete folder function like this (careful with your paths!! :) ):

    function fullDeleteFolder($dir) { 
      echo "Remove: ".$dir."
    "; if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (is_dir($dir."/".$object)){ fullDeleteFolder($dir."/".$object); }else{ unlink($dir."/".$object); } } } rmdir($dir); } } $location = "[some-location]/mpcache/mod_pagespeed"; fullDeleteFolder($location); //might also want to do this for the 'media/css_secure' folder too, if your site is on https echo "Finished.";

提交回复
热议问题