1

I have a custom module, which will add skin css

    <reference name="head">
        <action method="addItem">
            <type>skin_css</type>
            <name>css/banner.css</name>
        </action>
    </reference>

finally it includes the css for me in base theme

http://localhost/m1/skin/frontend/base/default/css/banner.css 

How can I make it load the css in current theme?

1
  • if you put your css in your current theme magento theme fall back will do it accordingly Commented Jul 20, 2016 at 6:52

2 Answers 2

4

Place your css in your current theme like:

skin/frontend/<package>/<theme>/css/banner.css

4
  • need to change layout syntax? seems cannot use additem and type if apply for solution Commented Jul 20, 2016 at 7:56
  • no need to change syntex... it is proper Commented Jul 20, 2016 at 8:56
  • if i change to <name>css/banner.css</name> to skin/frontend/rwd/default/css/banner.css, the path is duplicated localhost/m1/skin/frontend/base/default/skin/frontend/rwd/… Commented Jul 20, 2016 at 9:08
  • you have to set <name>css/banner.css</name> only, it willtake css form your current theme. if magento doesn't find css in current therm then it collects from base Commented Jul 20, 2016 at 9:13
0

If you are developing an extension and using css/js then you have to include in base/default package because when you give your extension someone else at that time you dont know which theme they are using .

That's why magento provide fallback mechanism so if you developing an extension then you have to use last fallback so your files always pickup and user can override your files by adding in own theme.

Hope this will help your concern

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.