9

How Can I override vendor/magento/magento2-base/lib/web/css/source/lib/_navigation.less file in my custom theme ?

asked Nov 29, 2016 at 5:29
0

4 Answers 4

9

You can try with

app/design/frontend/{Vendor}/{Theme}/web/css/source/lib/_navigation.less

Read more: How to override gallery.css

answered Nov 29, 2016 at 5:35
0
6

1) You have to copy _navigation.less from your parent theme to app\design\frontend\vendor\theme\web\css\source(your custom theme) and override your css after .lib-main-navigation(); and .lib-main-navigation-desktop(); this lib navigation style.

OR

2) you can override navigation variable's value in custom theme's _theme.less,

you can find variable name at lib\web\css\source\lib\variables

_navigation.less
answered Nov 29, 2016 at 5:39
1

In addition to Khoa TruongDinh's and Dipesh Rangani's answers, Khoa TruongDinh's overriding path is ok but in order to prevent magento overriding your custom styles, your custom styles, have to be added after the .lib-main-navigation(); and .lib-main-navigation-desktop(); as Dipesh Rangani mentioned so then in you custom theme's _navigation;less file you will have:

.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
}
answered Sep 15, 2017 at 9:51
0

This was extremely helpful, I was copying the lib file and editing within the .lib-main-navigation-desktop() class which was getting overwritten, now if I load this mixin first and put my styles after they overwrite

answered Jan 26, 2018 at 12:12

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.