1.2.0-3 • Published 3 years ago

sass-styles-typography v1.2.0-3

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

SASS Styles — Typography

Define fonts once, use everywhere

Installation

NOT YET

npm install @sass-styles/typography

Usage

As early as possible, include:

// entry.scss
@use "my-typography-styles" as m-t-s;
@use "@sass-styles/typography" with (
  $styles: m-t-s.$styles,
  $sizes: m-t-s.$sizes,
  $weights: m-t-s.$weights,
  $families: m-t-s.$families,
);

@use "base";
// _base.scss
@use "@sass-styles/typography" as t;

body {
  @include t.style(body);
}
// _my-typography-styles.scss
$families: (/* family names */);
$sizes: (/* size matching */);
$weights: (/* weight naming */);
$styles: (/* rule definitions */);

Options

$root-font-px-size

A Number

$length-unit

px, rem, or rem-px

Note: whichever unit is chosen, unitless length values are assumed to be in px.

$families

$sizes

$weights

$styles

“@mixin”s

style

rule

“@function”s

get-value

When getting size you may also pass $unit as a third parameter to explicitly request eithr the px or rem values. By default this will return in the same unit as $length-unit, or rem if $length-unit is rem-px.

FAQ

I get the error: Error: Can't find stylesheet to import

If you have installed SASS Typography via npm or yarn you will need to add --load-path=node_modules to your call too sass.\ Something like: sass app.scss app.css --watch --load-path=node_modules

Alternatively you can copy the _t.scss file into your own file directory. Then you can @use that file directly. However, this means you will need to do updates manually.

My version of SASS doesn’t have @use and I can’t upgrade

This should be fine, and should work as normal without the initial @use. The only issue may be that you now have functions with less readable names, if this becomes an issue for many people I will look into making less clashy aliases for mixins and functions.

1.2.0-1

3 years ago

1.2.0-3

3 years ago

1.2.0-2

3 years ago

1.0.0-alpha.19

3 years ago

1.0.0-alpha.20

3 years ago

1.0.0-alpha.18

3 years ago

1.0.0-alpha.16

3 years ago

1.0.0-alpha.17

3 years ago

1.0.0-alpha.15

4 years ago

1.0.0-alpha.13

4 years ago

1.0.0-alpha.10

4 years ago

1.0.0-alpha.12

4 years ago

1.0.0-alpha.11

4 years ago

1.0.0-alpha.9

4 years ago

1.0.0-alpha.8

4 years ago

1.0.0-alpha.7

4 years ago

1.0.0-alpha.6

4 years ago

1.0.0-alpha.5

4 years ago

1.0.0-alpha.3

4 years ago

1.0.0-alpha.1

4 years ago

1.0.0-alpha.0

4 years ago