【发布时间】:2013-05-01 11:39:52
【问题描述】:
如何更改 CSS 文件的顺序以加载模块的 CSS在主题的 CSS 之前?以下是一些代码示例:
主题的 CSS 文件(加载在所有页面上)添加到主题的 local.xml 中:
<default>
<reference name="head">
<action method="addItem">
<type>skin_css</type>
<name>css/theme.css</name>
</action>
</reference>
</default>
扩展的 CSS 文件(仅在类别页面上加载)添加到模块的 XML 布局文件中:
<catalog_category_layered>
<reference name="head">
<action method="addItem">
<type>skin_css</type>
<name>css/extension.css</name>
</action>
</reference>
</catalog_category_layered>
这是我在分类页面上加载的 CSS 文件的顺序,扩展的 CSS 在主题的 CSS 之后加载:
- /default/mytheme/css/styles.css
- /default/mytheme/css/theme.css
- /default/mytheme/css/extension.css
我想要实现的目标:扩展的 CSS 在主题的 CSS 之前加载。
如何强制 CSS 文件的这种顺序:
- /default/mytheme/css/styles.css
- /default/mytheme/css/extension.css
- /default/mytheme/css/theme.css
我注意到,如果我安装了许多扩展,则某些扩展的 CSS 在主题的 CSS 之前加载,而其他一些扩展的 CSS 在主题的 CSS 之后加载。我认为这与 Magento 中模块的顺序有关,但我不明白如何影响前端 CSS(或 JavaScript)文件的顺序。
【问题讨论】:
标签: magento layout magento-layout-xml