0

In my app/webroot/css directory, I have a cake.generic.css file. In app/View/Layouts/default.ctp, I have the following line:

echo $this->Html->css(array('cake.generic'));

I became suspicious when none of my edits to cake.generic.css were being reflected in my application's view.ctp files, so I experimented. I changed the name of cake.generic.css to dummy.dum, and reloaded my View. The layout remained unchanged. CSS was still being served from somewhere.

Now, when I comment out the reference to cake.generic in default.ctp:

echo $this->Html->css(array(/*'cake.generic'*/));

...and reload my View, I see immediately that the CSS is no longer in control of the layout. I get back basic, unadorned HTML. So my question is: If the cake.generic.css file located in app/webroot/css is not controlling my CSS, then what is? This makes no sense to me.

Chris
  • 501
  • 3
  • 15
  • 1
    My honest guess would be that the css was/is getting cached somehow that would explain why loading it worked after name change etc but not after a change to including it on the page. That is the css file though so look at caching to be the issue. Try in private tab etc – KaffineAddict Aug 09 '17 at 18:17
  • 1
    @KaffineAddict: You appear to be correct. Opening my app in Firefox and Safari revealed my CSS changes. Problem appears to be confined to Chrome. I'll look at my cache settings there, since most of my users prefer Chrome. Thanks for the direction! – Chris Aug 09 '17 at 18:29
  • Chrome is well known for this. I think you should look at this question and answer about disabling cache for development: https://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development – Szymon Aug 09 '17 at 18:33
  • @Szymon: Great tip. Thank you. – Chris Aug 09 '17 at 18:37

0 Answers0