mixin in js

Solutions on MaxInterview for mixin in js by the best coders in the world

showing results for - "mixin in js"
Coralie
05 Apr 2016
1/*
2	Mixins are Sass functions that group CSS declarations together.
3	We can reuse them later like variables.
4
5	We can create a mixin with @mixin ex: @mixin variable-name {}
6	
7	we can create a mixin as a function show below and add parameters as well
8
9	After creating the mixin, we can use it in any class with @include command.
10	
11	This approach simplifies the code.
12*/
13
14/****example-1****/
15@mixin my-flex {
16  display:flex;
17  align-items:center;
18  justify-content:center;
19}
20
21/****example-2****/
22$font-color: red;
23@mixin my-font($font-color) {...}
24
25/****HOW TO USE****/
26div { 
27  @include my-flex; 
28}
29
30
Inaya
22 Sep 2018
1shantay