Greetings all,

I am building out our theme one region at a time. Currently I'm working on the primary nav menu. Every time I make a change to page.tpl.php or template.php, I have to Flush All Caches from the admin menu in order to see the change. This takes a long time and makes development very slow. On the other hand, if I were to turn off *all* caching that would be slow too.

I'm wondering if there is a way to turn off caching just for the part of the template I'm currently developing. For example in template.php::theme_menu_link() where I build up the primary menu link HTML code. Is there a way to selectively and precisely turn off caching like this? Otherwise, how do you develop a theme without having to wait 2 minutes for the cache to clear every time you make a change?

Thanks.

Comments

Jaypan’s picture

Caching shouldn't be enabled on a development environment.

But if you want something faster, Drush will clear the caches faster than using the admin menu.

northk’s picture

Hi Jaypan,

My understanding is that if I turn caching off entirely in the dev environment, it will take a long time for pages to load (same as executing a clear caches from the admin menu). Is that true? If so, then it would be helpful to be able to selectively turn off caching. How would I turn off caching for the dev environment?

I attempted to install Drush on OS X using Brew and the install failed. Not sure where to go from there on getting Drush working.

Thanks,
northk

Jaypan’s picture

My understanding is that if I turn caching off entirely in the dev environment, it will take a long time for pages to load

It will, but it's generally how its done. Of course this will depend on the person, but I personally don't turn on caching on development environments.

If Drush install didn't work with Brew (which I'm surprised by) I'd suggest a manual install. The newest version is a little more work, but if you are not using D8, then you can use an earlier version.

One other question, are you developing locally? As in, do you have a local server (MAMP) that you are working on?

northk’s picture

Hi Jaypan,

Yes, I'm using MAMP pro for local development. It's really slow when I have to clear the cache every time I make a change to a template file -- even though I have a very fast machine. I guess I can try installing Drush again manually and see if the cache clearing command is faster in Drush. I'm developing on Drupal 7.