I have the following HTML:
<ul id="navbar-main" class="navbar-nav mr-auto">
<li class="nav-item active">
<a href="https://travian.dev/materials" class="nav-link nav-materials">
<span class="invisible">Materials</span>
</a>
</li>
</ul>
And the following SCSS:
#navbar-main {
li {
&.nav-item {
.nav-link {
width: 50px;
height: 50px;
background: no-repeat center;
background-size: contain;
&.nav-materials {
background-image: url('../images/buttons/menu-materials.png');
}
}
&.active {
.nav-link {
&.nav-materials {
background: red;
}
}
}
}
}
}
This is working, but I'd like it more maintainable/ easier to read. If possible, I'd like it to be like this:
#navbar-main {
li {
&.nav-item {
.nav-link {
width: 50px;
height: 50px;
background: no-repeat center;
background-size: contain;
&.nav-materials {
background-image: url('../images/buttons/menu-materials.png');
.active { // here something to actually select .nav-item.active .navlink.nav-materials
background: red;
}
}
}
}
}
}