I want to load a custom CSS file in Magento's Admin Area. My approach is to do it exactly as I would in the frontend:
<action method="addCss">
<file>namespace/module/mycss.css</file>
</action>
That generates the following <link>
tag:
<link rel="stylesheet" type="text/css"
href="http://host/skin/adminhtml/base/default/namespace/module/mycss.css"
media="all">
That tells me that Magento is looking for my CSS in /skin/adminhtml/base/default/namespace/module
. So if I put it there, I'd probably be fine and everything would work.
But that just doesn't seem like the proper way to do it since /skin/adminhtml/base
doesn't even exist.
The whole thing seems even weirder to me when I look at a core module like Mage_Widget
. It adds CSS files the exact same way:
<action method="addCss"><name>lib/prototype/windows/themes/magento.css</name></action>
But that file is stored unter /skin/adminhtml/default/default/lib/...
What am I doing wrong?
You can find all the CSS files in one of these folders below: [Magento Root Folder]/skin/frontend/YOUR_PACKAGE/YOUR_THEME which contains CSS file of user's interface. [Magento Root Folder]/skin/adminhtml/YOUR_PACKAGE/YOUR_THEME for CSS file of admin's interface.
base/default is the appropriate location for this file. It is the ultimate fallback regardless of design area. It would not be inappropriate to provide theme assets under default/default given the precedent from the core team. If present in the latter of these two themes, the link would be generated for that path before the former.
Incidentally, if you rename app/design/adminhtml/default to app/design/adminhtml/base the admin theme works fine.
<?xml version="1.0"?> <layout> <default> <reference name="head"> <action method="addCss"> <name>module/custom.css</name> </action> </reference> </default> </layout>
<config> ... <adminhtml> <layout> <updates> <namespace_module> <file>module.xml</file> </namespace_module> </updates> </layout> </adminhtml> ... </config>
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With