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

fontscale-sass

v1.0.2

Published

A SASS font-scale generator module

Downloads

1

Readme

Font scale sass

You want to customize your Sass typographic scale but get tired of finding out how to have a great design scale? Then this module's gonna help you a lot ~

It provides a preset font size for your footnote, endnote, caption, body, blockquote, and headings (from h6 to h1).

Acknowledgement

The module refers to the following great articles and projects. For a better understanding of how the typography works (typically what's behind this module), you can try spending time reading them as a small research:

The result given by the module has a deviation with the layoutgridcalculator ones in around 0.01 - 0.02 (em)

Quick start

Install

You can install the module by one of the following way:

  • NPM
npm install fontscale-sass --save-dev
  • Yarn
yarn add fontscale-sass --dev
  • PNPM
pnpm add -D fontscale-sass

Deal with the folder

After installing successfully, go to the directory where the module located:

  • For npm/yarn/pnpm, you can find the folder named fontscale-sass in node_modules folder.
  • For manually download, you can find the unzipped Font-scale-sass-{tag} folder.

Go to that folder and pick up the font-scale folder which have the below file structure:

font-scale
  |
  |-- utils
  |     |-- _common.scss
  |     |-- _constant.scss
  |     |-- _index.scss
  |
  |-- _index.scss

You can choose how to deal with the folders by one of the following ways:

  • Place the folder at your project's root stylesheet directory
  • Use --load-path for dart sass compiling command
    sass --load-path=path/to/font-scale style.scss style.css

Import the module

@use 'font-scale';

or

@use 'font-scale' as *;

Usage

The font-scale module provides only one API to you:

@mixin createTypoScale($unit: 'em', $ratio: 'classical', $steps: 'pentatonic', $composition: 'fibonacci')

Parameters

  • $unit: Represent the css font-size unit that will be rendered. Default: 'em'

    | Unit | Value | |---------|-------| | 'pica' | 1em | | 'em' | 1em | | 'rem' | 1rem | | 'px' | 16px | | 'pixel' | 16px |

  • $ratio: The ratio in a typographic scale. Default: 'classical'

    | Ratio | Value | |-------------|-------| | 'classical' | 2 | | 'golden' | 1.618 |

  • $steps: The number of steps for each interval. An interval in the classical typography is defined as 6->12, 12->24, etc... Default: 'pentatonic'

    | Step | Value | |---------------|-------| | 'monotonic' | 1 | | 'ditonic' | 2 | | 'tritonic' | 3 | | 'tetratonic' | 4 | | 'pentatonic' | 5 | | 'hexatonic' | 6 | | 'heptatonic' | 7 | | 'octatonic' | 8 | | 'chromatic' | 12 |

  • $composition: Type of the composition number series. Default: 'fibonacci'

    | Composition | |---------------------| | 'fibonacci' | | 'lucas' | | 'pentagonal' | | 'triangular number' |

Return

By default, the following css elements will be rendered

.footnote {
  font-size: 0.66em;
}

.endnote {
  font-size: 0.758em;
}

.caption {
  font-size: 0.758em;
}

body {
  font-size: 1em;
}

blockquote {
  font-size: 1em;
}

h6 {
  font-size: 1em;
}

h5 {
  font-size: 1.149em;
}

h4 {
  font-size: 1.32em;
}

h3 {
  font-size: 1.741em;
}

h2 {
  font-size: 2.639em;
}

h1 {
  font-size: 5.278em;
}

Example

Generate the typographic scale in golden ratio, pentatonic steps and fibonacci composition

@use 'fontscale-sass' as *;

// Pentatonic steps and fibonacci composition is default
@include createTypoScale($ratio: 'golden');