Topic: How to @extend dynamically generated classes like py-2 in _custom_styles.scss?

ggiani pro asked 1 year ago


In '_custom-styles.scss' I want to extend some bootstrap classes like py-2, for example

.myclass {
  @extend .py-2;
  color:green;
}

but I get this sass error:

Error in plugin "sass"
Message:
    scss/_custom-styles.scss
Error: ".myclass" failed to @extend ".py-2".
       The selector ".py-2" was not found.
       Use "@extend .py-2 !optional" if the extend should be able to fail.
        on line 13 of scss/_custom-styles.scss
>>       @extend .py-2;

   --------------^

How can I solve this issue?


Krzysztof Wilk staff commented 1 year ago

Hi!

Which version of the sass do you use? From version 3.3.0 sass is throwing an error with extends that it can't find in the document.

You can try to import a file where the .py-2 class is or downgrade your sass compiler :)

Best regards



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.19.2
  • Device: Desktop
  • Browser: Chromium
  • OS: Linux
  • Provided sample code: No
  • Provided link: No