How do theming and css work (does it cache css)

Events happening in the community are now at Drupal community events on www.drupal.org.
purcell's picture

I am reading through "Pro Drupal Development" a bit and I am a bit confused about how theming and css work (maybe I just have not read far enough yet).

I am working on master.css within a theme. I modify master.css, drop it back into the correct location within sites/default/themes/themename, but when I refresh the web page and view the css, my edits are not in the css.

Does drupal cache or do something else with css files when it strips out whitespace and generates one csss file?

(any suggestions for how to fix this or even places to read up on theming and css would be awesome)

Purcell

Comments

addendum

purcell's picture

Is there something that goes through on a timed basis, grabs together the css files, strips out whitespace and dumps them in /sites/default/files/css? That is where my page links to its css and I can see from browsing the directory that the files there are older than the ones I updated in /sites/default/themes/themename.

I would first check in the

acouch's picture

I would first check in the header and see if the master.css file is being served.

It will look something like '.

Drupal does have the ability to cache css file which is controlled in 'admin/settings/performance'. You can turn css and js aggregation on or off and you can clear Drupal's cache. If you do have css aggregation on your changes in the master.css file will not become apparent until you've cleared the cache.

If you are doing theming work you are going to want to be able to clear the cache pretty often. I would recommend the admin_men module which gives you an administrative menu at the top of the screen which contains a link to clearing the cache, and / or the devel module which allows you to place a block on your site with a link to clearing the cache.

Drupal has a theming registry that will also need to be cleared as your are theming. It caches all theme functions and theme templates.

Dev module

cgapperi's picture

First thing I always do when something is not displaying as expected is to empty my cache. I can't tell you how much time I have spent troubleshooting an issue only to have it resolve itself after a cache refresh.

I like admin-men (http://drupal.org/project/admin_menu), as well. I find devel module (http://drupal.org/project/devel) invaluable. So much so that it is always the first module I install. It gives you access to:

* Devel settings
* Empty cache
* Execute PHP Code
* Function reference
* Hook_elements()
* PHPinfo()
* Rebuild menus
* Reinstall modules
* Run cron
* Session viewer
* Theme registry
* Variable editor

There is also a module that used to be included with Devel, devel_themer (http://drupal.org/project/devel_themer), that is really quite useful. If you turn it on, it allows you to select any element on your page and it will tell you what tpl.php filename and function you would create to modify that specific element. It can play not so nice with browsers at time, just remember to turn it on and off as necessary.

Remeber to empty the cache....

Central Iowa Drupal Users Group

Group categories

Category

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: