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

postcss-typography2

v3.0.0

Published

A postcss plugin for typography.js

Downloads

5

Readme

postcss-typography2

A postcss plugin for typography.js

Forked from BarryThePenguin/postcss-typography

  • Updates dependency versions
  • Reports warning when @typography rule not present in your css
  • Adds support for using rhythm() in your css

Installation

npm install postcss-typography2

Usage

Add to your postcss.config.js

const typography = require('postcss-typography2');
const Alton = require('typography-theme-alton').default;

module.exports = {
  plugins: [
    typography(Alton);
  ]
}

Or manually with:

const postcss = require('postcss');
const typography = require('postcss-typography2');
const Alton = require('typography-theme-alton').default;

const result = postcss([plugin(Alton)]).process(input);

Next in your CSS add the @typography “at-rule”

@typography;

The plugin will replace this with the final typography css rules. You can include overrides here as well.

@typography {
  h1,h2,h3 {
    color: blue;
  }
}

Rhythm units can also be used throughout your css:

.text {
  margin: rhythm(1.5) 0;
}

The plugin will replace this with the calculated result

.text {
  margin: 2.9rem 0;
}

API

typography([options])

options

Options to pass through to the typography api

You will likely be passing a Typography theme, there are over 30 available!

@typography

This plugin will replace the @typography “at-rule” with the output of typography.js. Any declarations within the at-rule block will be merged with the final css output.

rhythm(unit)

This plugin will replace rhythm() functions with the calculated rhythm unit based on your typography.js config. Only basic math arithmetic is allowed: division, multiplication, add and subtract. CSS custom properties and variables (sass, less etc.) will not be parsed.

License

MIT © Jamie Sinclair