Assign CSS file for different templates

Hi, whats the best way to include a css file in the of the template for different views?

Ideally I would like to include a product.css file for the product view and categories.css for the categories view and so on.

I would hate to include all the css files for the site in the styles hook even though they are not being used in the current view.

I guess I can do a long {if} statement in the styles hook… checking the $controller variable and then including the appropriate css file but I just wanted check if there was a better way.

any ideas?


In your skins//customer/addons/my_changes/hooks/index/ You can add:



Note that you should provide a local_XXX.css file for each controller or if you only wanted to do a few, you could do something like:
{if $controller == 'categories'
|| $controller == 'products'
|| $controller == 'pages'


thanks for your response!

just a quick follow up… what is the significance of the “local_” prefix in the css filename?

thanks again!

Personal choice so that when I look at things in firebug I can clearly see the difference between the standard names (styles.css) and can clearly see my locally modified filenames (local_styles.css).