![Theme Switcher Image](https://stackcoder.in/images/theme-switcher.png?cb=stackcoder90070)
Good content takes time and effort to come up with.
Please consider supporting us by just disabling your AD BLOCKER and reloading this page again.
In the previous article we got to know in depth understanding of Sass/SCSS and how to use it.
If you are still new to Sass/SCSS then I recommend to check out my in depth article Sass or SCSS In-Depth Tutorial
In this article, I will be covering the difference between @mixin, @extends, and Placeholder.
When you use the @mixin in the code it will replicate the code in all the using blocks
Example -
@mixin wrapper{
margin:0px auto;
padding: 0px;
}
.w1{
@include wrapper;
}
.w2{
@include wrapper;
}
will be compiled to the following
.w1 {
margin: 0px auto;
padding: 0px;
}
.w2 {
margin: 0px auto;
padding: 0px;
}
The styles in the .w1 and .w2 styles is redundant
wrapper{
margin:0px auto;
padding: 0px;
}
.w1{
@extend wrapper;
}
.w2{
@extend wrapper;
}
will be compiled to the following
wrapper, .w1, .w2 {
margin: 0px auto;
padding: 0px;
}
Here the styles are not redundant, @extend is intelligent enough and adds wrapper,.w1,.w2
But there is one problem with this, if I don't use wrapper in my project then we are simply adding the redundant code in our style.
Example -
%wrapper{
margin:0px auto;
padding: 0px;
}
.w1{
@extend %wrapper;
}
.w2{
@extend %wrapper;
}
will be compiled to the following
.w1, .w2 {
margin: 0px auto;
padding: 0px;
}
Install Linux, Apache, MYSQL, PHP (LAMP Stack) on Ubuntu
What Is Laravel Resourceful Controllers?
Debugging Laravel Queue Email Issues
Google, Twitter, GitHub, Facebook & Many Other Social Generic Logins With PHP Laravel Socialite
Send SMS With Amazon SNS (Simple Notification Service) Using PHP
Install Packages Parallel For Faster Development In Composer
Push Files To CPanel / Remote Server using FTP Software FileZilla
Install Apache Web Server On Ubuntu 20.04 / Linux & Manage It
URL Redirects From Called Functions In Laravel
Move Uploaded Files From Local Computer Or Server To Amazon S3 Bucket In PHP
Sass or SCSS @mixin vs @extends vs Placeholder (%)
Custom Validation Rules In PHP Laravel (Using Artisan Command)