npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@guyn-style/typography

v0.1.0-alpha.13

Published

Guyn Style Typography Module

Downloads

1

Readme

Typography

Defining fonts

Include or define up to 4 fonts.

| Font | Variable | | ---- | ----------------- | | 1st | $font-primary | | 2nd | $font-secondary | | 3rd | $font-tertiary | | 4th | $font-quaternary |

Settings

| Property | Default value | Example | Type | | ---------------- | ------------------------------- | --------------------------------- | ------- | | font-family* | null | "Graphik", sans-serif | string | | load | false | true | boolean | | weights | () | ('light': 200, 'Regular': 400 ) | map | | weight-classes | false | true | boolean | | path | "/fonts" | "/assets/fonts" | string | | files | "woff2", "woff", "ttf", "eot" | | list | | use | () | ('h1','.title','blockquote') | list | | types | ('normal') | ('normal','italic') | list |

* is required

Example

$font-primary: (
	font-family: (
		Graphik,
		sans-serif,
	),
	load: true,
	weights: (
		"Light": 100,
		"Regular": 400,
		"Medium": 500,
		"Bold": 600,
		"Black": 800,
	),
	weight-classes: false,
	path: "/fonts",
	files: (
		"woff2",
		"woff",
		"ttf",
		"eot",
	),
	use: (
		"h1",
		"h3",
		"h4",
		"span.text",
		"#section",
	),
	types: (
		"normal",
		"italic",
	),
);

::: tip

  • Font weights need to be set in order to load fonts.
  • Font weight names must be identical to actual file names.
  • The first entry in font-family will be loaded when loaded is true.
  • The space in a font-family name will be removed for the file name. Helvetica Neue will be HelveticaNeue
  • Font includes uses the following syntax: fontFamily-fontWeightName.ttf
  • When font-type "italic" is added, the file name should be fontFamily-fontWeightNameItalic.ttf
  • There is an issue with font-family names with spaces. Avoid these for now. :::

Weights

classes

Guyn can automatically generate classes based on the given font-weights. Enable the weight-classes and guyn will give you classes like .font-light{ font-weight: 100; }

function

You can also use the font-weight() function.

.element {
	font-weight: font-weight(Light);
}

Will give you the Light weight from any of the included font-sets. When there are double font-weights over multiple font-sets. The font-weight hierarchy is: primary > secondary > tertiary > quaternary. So primary will overrule.

If you want to use a font-weight, which is overruled by an earlier set. You can use the second argument.

.element {
	font-weight: font-weight(Light, $font-tertiary);
}

Using fonts

Weights

classes

Guyn can automatically generate classes based on the given font-weights. Enable the weight-classes and guyn will give you classes like .font-light{ font-weight: 100; }

function

You can also use the font-weight() function.

.element {
	font-weight: font-weight(Light);
}

Will give you the Light weight from any of the included font-sets. When there are double font-weights over multiple font-sets. The font-weight hierarchy is: primary > secondary > tertiary > quaternary. So primary will overrule.

If you want to use a font-weight, which is overruled by an earlier set. You can use the second argument.

.element {
	font-weight: font-weight(Light, $font-tertiary);
}

Loading fonts

Guyn has a special way of embedding fonts. Fonts includes can be setup by defining a map containing all the necessary information. When this variable is set, Guyn will automatically load the fonts and set all necessary use cases from this config.

Defining fonts

There are 4 fonts to be set this way. Defining any of the variables below the config will load the font.

| Font | Variable | | ---- | ------------------ | | 1st | $font-primary | | 2nd | $font-secondary | | 3rd | $font-tertiary | | 4th | $font-quaternary |

Settings

| Property | Default value | Example | Type | | ---------------- | ------------------------------- | --------------------------------- | ------- | | font-family* | null | "Graphik", sans-serif | string | | load | false | true | boolean | | weights | () | ('light': 200, 'Regular': 400 ) | map | | weight-classes | false | true | boolean | | path | "/fonts" | "/assets/fonts" | string | | files | "woff2", "woff", "ttf", "eot" | | list | | use | () | ('h1','.title','blockquote') | list | | types | ('normal') | ('normal','italic') | list | | display | swap | swap | string |

* is required

Example

The below example is how you structure a config file. When this variable is set before the include of Guyn. Guyn will pick this up and load the font. The below example will load the Graphik font, in all the given weights,for all the given files. Won't create classes for the weights but will automatically add the font-family already to all elements given in Use.

$font-primary: (
	font-family: (
		Graphik,
		sans-serif,
	),
	load: true,
	weights: (
		"Light": 100,
		"Regular": 400,
		"Medium": 500,
		"Bold": 600,
		"Black": 800,
	),
	weight-classes: false,
	path: "/fonts",
	files: (
		"woff2",
		"woff",
		"ttf",
		"eot",
	),
	use: (
		"h1",
		"h3",
		"h4",
		"span.text",
		"#section",
	),
	types: (
		"normal",
		"italic",
	),
	display: "swap",
);

::: tip

  • Font weights need to be set in order to load fonts.
  • Font weight names must be identical to actual file names.
  • The first entry in font-family will be loaded when loaded is true.
  • The space in a font-family name will be removed for the file name. Helvetica Neue will be HelveticaNeue
  • Font includes uses the following syntax: fontFamily-fontWeightName.ttf
  • When font-type "italic" is added, the file name should be fontFamily-fontWeightNameItalic.ttf
  • There is an issue with font-family names with spaces. Avoid these for now. :::

Other mixins

font-use

Use a given font on multiple places at once.

| Arguments | Example | Type | | --------- | ------------------------ | ------------------ | | $use | h2 or ("h1","h3") | string or list | | $family | "Inter UI, sans-serif" | string |

@include font-use("h2", "Inter UI, sans-serif");

// output:

h2 {
	font-family: "Inter UI", sans-serif;
}

or with a list given;

@include font-use(("h2", "h3", "h4"), "Inter UI, sans-serif");

// output:

h2,
h3,
h4 {
	font-family: "Inter UI", sans-serif;
}

font-include

Include a single font.

| Arguments | Default | Description | Type | | ---------- | -------------------------------- | --------------------------------------------- | --------------------- | | $name | null | Name of the font | string | | $file | null | Filename | string | | $weight | normal | Weight to be set | string or number | | $type | normal | Normal or Italic | string | | $files | ( "eot", "woff", "svg", "ttf") | File types to be used | string or list | | $path | $base-font-path | The path to the files | string | | $display | swap | font-display property. Can be set to false. | string or boolean | | $italic | 'Italic' | String to be used when including Italic fonts | string |

Example

Arguments must be given with their variables. In this case some can be left out and get replaced by their respective defaults. Also any order can be given.

@include font-include(
	$name: "Inter UI",
	$file: "Inter-Regular",
	$weight: 400,
	$type: normal,
	$files: (
		"woff2",
		"woff",
	),
	$path: "assets/fonts/",
	$display: "swap"
);

::: tip

  • When giving the $type "italic", the string given by $italic, will automatically added to the file name. :::

font-list

Include a set of multiple font weights single font.

| Arguments | Default | Description | Type | | ---------- | -------------------------------- | --------------------------------------------- | --------------------- | | $name | null | Name of the font | string | | $file | null | Filename | string | | $weights | (400) | Weights to be set | string or number | | $type | normal | Normal or Italic | string | | $files | ( "eot", "woff", "svg", "ttf") | File types to be used | string or list | | $path | $base-font-path | The path to the files | string | | $display | swap | font-display property. Can be set to false. | string or boolean | | $italic | 'Italic' | String to be used when including Italic fonts | string |

Example

Arguments must be given with their variables. In this case some can be left out and get replaced by their respective defaults. Also any order can be given.

@include font-list(
	$name: "Inter UI",
	$file: "Inter-Regular",
	$weight: (
		"Light": 100,
		"Regular": 400,
		"Medium": 500,
		"Bold": 600,
	),
	$type: normal,
	$files: (
		"woff2",
		"woff",
	),
	$path: "assets/fonts/",
	$display: "swap"
);