I have a block, which is appearing in the backend, and is adding a css file via the usual command:
$this->getLayout()->getBlock('head')->addCss('mymodule/css/filename.css');
And this should work, except that it is only looking for the file in skin/adminhtml - and I want to include the file from skin/frontend, because that is where it currently resides.
I am overcoming this temporarily by the brute force measure of copying the file from skin/frontend/default/mymodule/css/filename.css
to skin/adminhtml/default/mymodule/css/filename.css
, but I would rather refer to it directly. Is there some way to make the addCss command look in frontend instead of adminhtml?
If it is indeed a new CSS file for a custom module, it should reside in skin/adminhtml/default/default/css/ , like any of the other distinct skin assets.
Edit based on OP comment:
Because it is your new file, you can switch the area for the core/design_package
instance from adminhtml to frontend and then revert it. However, my preference or expectation would be to see a stylesheet under skin/adminhtml/default/default/ which calls
@import('../../../frontend/base/default/css/file.css');
For this use case there isn't an absolute best practice, so it's up to you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.