I'm new in SASS and programming language.
.row
{
@include make-row;
}
In the above @include
, is it equal to @import
function in sass? Can you explain the functionality of @include
.
@import imports a whole file, @include includes a @mixin piece of code. It allows you to create reusable code.
@mixin example($color, $style, $weight) {
border: $color, $style, $weight;
width: 100px;
height: 100px
padding: 10px;
}
.box {
@include example(#000, solid, 1px);
}
In SASS @include is related to mixins, don't mistake this for @import as they do two completely different things.
@mixin blue-text {
color: blue;
}
span {
@include blue-text;
}
You will end up with:
span {
color: blue;
}
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