Avatar of dlearman1
dlearman1Flag for United States of America

asked on 

Why is this Sass mixin generating an error: "Dart Sass failed with this error: Undefined mixin."

The mixin is defined in a component file (near the bottom):
 _header-footer-and-navigation.scss

// Mobile Menu 
.c-navbar {
    display: block;
    width: max(16rem, 33.3vw);                            
    height: 100vh;                  
    background: #000;               

    &__items {
        display: flex;
        flex-flow: column nowrap;
        justify-content: flex-start;
        align-items: flex-start;
        text-align: left;
        padding: 0 4rem;
        
        &--link {
            display: none;
            width: 100%;
            text-align: left;
            text-decoration: none;
            color: $brand-white;
            padding: 2.5rem 0;
        
            & a {
                display: block;
                color: $brand-white;
                text-decoration: none;
            }

            & a:hover {
                display: block;
                color: $brand-gold;
            }

            & a:active {                                // not needed
                display: block;
                color: $cool-grey;
            }

            & .has-submenu {

                & > a::after {
                    font-family: "Ionicons";
                    font-size: 1.2rem;
                    line-height: 1.6rem;
                    font-weight: 900;
                    content: "caret-down";
                    color: white;
                    padding-left: .5rem;
                }
             }
        } 
    }

    &__subitems {
        margin: 0;
        padding: 0;
        font-family: $font-family-base;
        font-size: calc(#{$font-size-base} * .875);
        font-weight: 300;
           text-align: left;
           text-decoration: none;
    
        &--link {
            display: none;                    
            padding: 1rem 1.5rem;
            color: $brand-gold;

            &:hover {
                color: green;
            }
        }
    }
}

    
// Tablet & Desktop Menu
@mixin c-navbar--md {
    .c-navbar {
       width: 100vw;
       height: auto;
       background: $brand-white;

       &__items {
            display: flex;
            flex-flow: row nowrap;
            justify-content: flex-start;
            align-items: baseline;
            text-align: left;
            padding: 0 4rem;
       }
    }
}
    



// show menu items
.active .c-navbar__items--link {
    display: block;
}

// show submenu items
.submenu-active .c-navbar__subitems--link {
    display: block;
}

Open in new window

The mixin is called from:
_media-queries.scss

// md: tablets - landscape
@media (min-width: 768px) {
    @include container--md();
    @include font-size-base--md();
    @include body-copy--md();
    @include banner-head--md();
    @include page-head--md();
    @include section-head--md();
    @include sub-head--md();
    @include paragraph-head--md();
    @include small-head--md();
    @include subtitle-lg--md();
    @include subtitle-sm--md();
    @include main-nav-head--md();
    @include button--md();
    @include caption--md();
    @include l-wrapper-text--md();
    @include c-navbar--md();
}

Open in new window

This mixin is constructed and handled virtually identical to other mixins, which do not raise an error. I thought it might be the use of "live" units, vw and auto, but that doesn't seem to be the case. I'm hoping somebody can explain this behavior. Here is the error message:

Dart Sass failed with this error: Undefined mixin.
   ╷
69 │     @include c-navbar--md();
   │     ^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  _media-queries.scss 69:2  @import
  main.scss 8:9             root stylesheet
CSS* SASS (Syntactically Awesome Stylesheets)* SCSS

Avatar of undefined
Last Comment
David Johnson, CD
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
CSS
CSS

Cascading Style Sheets (CSS) is a language used for describing the look and formatting of a document written in a markup language. Usually used to change web pages and user interfaces written in HTML, it can also be applied to any kind of XML document. CSS is designed primarily to distinguish the content of a document from its presentation.

43K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo