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

@thedatalife/stylelint-encourage-vertical-rhythm

v0.0.3

Published

Stylelint plugin to warn when a vertical rhythm unit is not used in a css property that will affect the vertical rhythm of the page.

Downloads

1

Readme

Style Lint - Encourage Vertical Rhythm

A simple stylelint plugin to encourage (or enforce) the consideration of vertical rhythm in css.

Takes a single string as the argument and this is used in a regular expression to validate the presence of the string inside any property that can affect vertical rhythm.

Installation

npm install @thedatalife/stylelint-encourage-vertical-rhythm

Usage

The plugin takes a string as the first argument and uses that value in the regular expression check of the property value. This allows the developer to define the best convention (function or variable) for the project.

var vrProps = [
  'height',
  'padding-top',
  'padding-bottom',
  'margin-top',
  'margin-bottom',
  'line-height',
  'border-top',
  'border-bottom'
];

Basic Use

'thedatalife/encourage-vertical-rhythm': 'baseline'

This will match both the use of baseline as a function or variable.

@function baseline($multiplier) {
    @return 24px * $multiplier;
}

.module1 { margin-bottom: baseline(1.5); }
$baseline: 24px;

.module1 { margin-bottom: $baseline * 1.5; }

Advanced Use

It's also possible to provide your baseline value as config. This will allow the plugin to provide copy and paste suggestions on what to replace the invaid property with.

Provide a baseline and type property. Type can be either 'function' or 'variable'.

As a function

'thedatalife/encourage-vertical-rhythm': ['baseline', {baseline: 24, type: 'function'}]

A vertical rhythm property with 48px would throw a warning with the suggestion baseline(2).

As a variable

'thedatalife/encourage-vertical-rhythm': ['baseline', {baseline: 24, type: 'variable'}]

A vertical rhythm property with 48px would throw a warning with the suggestion $baseline * 2.

Tests

The plugin uses tape to provide unit test. Start the test suite with npm run test.

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Inspiration

Vertical rhythm is an often misunderstood concept. It's an important part of design architecture and if respected it can bring harmony to the flow of a page. This plugin was inspired by a variety of sources:

http://www.gridlover.net/try https://pilot.co/blog/implementing-baseline-rhythm-in-css/ https://www.smashingmagazine.com/2012/12/css-baseline-the-good-the-bad-and-the-ugly/ https://medium.com/@tbredin/a-jolly-web-typesetting-adventure-42948ab0d1dd