Could you please tell me if it's possible to turn off loading of styles.css from default/default/css when I use theme default/my_theme and that doesn't have styles.css? Why does magento load for other theme styles.css from default/default?
2 Answers
Try this.
Define layout.xml
This layout xml file is a unique layout file, that will be processed at last by Magento. This makes this layout file extremely good to remove/change layout appearance. Here you need to remove a css file. So you can use this.
File : app/design/frontend/<package>/<theme>/layout/local.xml
<layout>
<default>
<reference name="head">
<action method="removeItem">
<type>skin_css</type>
<name>css/styles.css</name>
</action>
</reference>
</default>
</layout>
Description
head is a special block that is used to hold css and js files. styles.css resides in this block. It is included through page.xml layout file.
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
This is how it is included to head section. Here the action takes place addCss. This method uses a type skin_css by default. ie any css file that resides in skin directory can included by this method. You can also use addItem method. But you need to specify type attribute as skin_css, in order to use that method.
In order to remove an item that is added by addCss or addItem method, you can use removeItem. This method accepts two parameters. type and name. In our case type is skin_css (since styles.css resides in skin) and name is css/styles.css.
Hope that helps