next-scss
Lightweight scss functions and mixins
Installation
npm install @nextindex/next-scss
Import
@import "~@nextindex/next-scss/next-scss";
Functions
rem
padding: rem(15);
em
padding: em(15);
strip-units
line-height: strip-units(1px);
shade
background: shade(#eee, 10%);
tint
background: tint(#eee, 10%);
new-breakpoint
@function new-breakpoint($query: $feature $value $columns, $total-columns: $grid-columns);
Mixins
bem
.block {
@include has(element) { ... }
@include variant(light) { ... }
@include is(active) { ... }
}
media
default variables and sizes:
$xs-screen: 480px!default;
$sm-screen: 768px!default;
$md-screen: 968px!default;
$lg-screen: 1206px!default;
$xl-screen: 1380px!default;
$xs-down: new-breakpoint(max-width $xs-screen 2);
$xs-up: new-breakpoint(min-width $xs-screen 2);
$sm-down: new-breakpoint(max-width $sm-screen 2);
$sm-up: new-breakpoint(min-width $sm-screen 2);
$md-up: new-breakpoint(min-width $md-screen 4);
$md-down: new-breakpoint(max-width $md-screen 4);
$lg-down: new-breakpoint(max-width $lg-screen 8);
$lg-up: new-breakpoint(min-width $lg-screen 8);
$xl-up: new-breakpoint(min-width $xl-screen 4);
$xl-down: new-breakpoint(max-width $xl-screen 4);
Example usage:
.my-class {
@include media($sm-up) {
....
}
}
utility-edit
@include utility-edit();
object-fit
@include object-fit($fit: fill, $position: null);