Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.
/ sass-em Public archive

Sass function & mixin to generate em value.

License

Notifications You must be signed in to change notification settings

sass-collective/sass-em

Repository files navigation

Sass Em

Version Download License

DEPRECATED: this package has been moved to new reference in Sass Collective monorepo @sass-collective/em, use this package because the current repository is no more maintained.

Introduction

Sass function & mixin to generate em value.

Install

npm install @sass-collective/sass-em --save

Usage

Function

em($values, $context);

Mixin

em($property, $values, $context);

Module System

@use "@sass-collective/sass-em";

// Function

html,
body {
    // Single value
    font-size: sass-em.em(16, 16);
    
    // Multiple values
    margin: sass-em.em(20 30, 16);
}

// Mixin

html,
body {
    // Single value
    @include sass-em.em(font-size, 16, 16);
    
    // Multiple values
    @include sass-em.em(margin, 20 30, 16);
}

Legacy @import

@import "@sass-collective/sass-em";

// Function

html,
body {
    font-size: sass-em(16, 16);
    margin: sass-em(20 30, 16);
}

// Mixin

html,
body {
    @include sass-em(font-size, 16, 16);
    @include sass-em(margin, 20 30, 16);
}

CSS

html,
body {
    font-size: 1em;
    margin: 1.25em 1.875em;
}