Magento 2如何覆盖vendor / magento / magento2-base / lib / web / css / source / lib / _navigation.less?


Answers:



6

1) 你必须复制_navigation.less从父主题app\design\frontend\vendor\theme\web\css\source(自定义主题),并覆盖你的CSS后.lib-main-navigation();.lib-main-navigation-desktop();这个LIB导航风格。

要么

2) 您可以在自定义主题的中覆盖导航变量的值 _theme.less

您可以在以下位置找到变量名称 lib\web\css\source\lib\variables

_navigation.less

1

除了Khoa TruongDinh和Dipesh Rangani的答案之外,Khoa TruongDinh的替代方法还可以,但是为了防止magento覆盖您的自定义样式,必须在.lib-main-navigation()之后添加您的自定义样式;和.lib-main-navigation-desktop(); 正如Dipesh Rangani所提到的,因此在您自定义主题的_navigation中,您将拥有更少的文件:

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {

     .lib-main-navigation();

     Your custom code here
}


.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {

    .lib-main-navigation-desktop();

    Your custom code here
}

0

这非常有帮助,我正在复制lib文件并在.lib-main-navigation-desktop()类中进行编辑,该类已被覆盖,现在,如果我先加载此mixin并在覆盖后放置样式,

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.