I am getting this error in my angular project.
@include for-desktop-up {...." No mixin named for-desktop-up"
My code in the styles.scss is
@mixin for-desktop-up {
@media (min-width: 1024px) { @content; }
}
My code in a stylesheet of a component is
@include for-desktop-up {
//some scss code
}
What am I doing wrong or what is going on?
A mixin is defined with the @mixin directive. Tip: A tip on hyphens and underscore in Sass: Hyphens and underscores are considered to be the same. This means that @mixin important-text { } and @mixin important_text { } are considered as the same mixin!
Using SCSS(Syntactically Awesome Stylesheet) The variable creation is the most useful feature of the SCSS. Using variables in your SCSS based angular project helps you to remove a lot of duplicated code from your style sheets.
Mixins allow you to define styles that can be re-used throughout your stylesheet. They make it easy to avoid using non-semantic classes like .float-left , and to distribute collections of styles in libraries.
Either import the file in component.ts as
styleUrls: ['./styles.scss']
or
use SASS/SCSS import to import in component.scss
@import "styles.scss";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With