0

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 2

1

Create a local.xml in your theme, in your <default> handler use under reference head removeItem to remove it

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.