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 🙏

© 2026 – Pkg Stats / Ryan Hefner

postcss-merge-longhand

v9.4.0

Published

Merge longhand properties into shorthand with PostCSS.

Readme

postcss-merge-longhand

Merge longhand properties into shorthand with PostCSS.

Install

With npm do:

npm install postcss-merge-longhand --save

Example

Merge longhand properties into shorthand; works with margin, padding, inset, scroll-margin, scroll-padding, border, columns and the box alignment place-* shorthands. For more examples see the tests.

Input

h1 {
  margin-top: 10px;
  margin-right: 20px;
  margin-bottom: 10px;
  margin-left: 20px;
}

h2 {
  column-width: 12em;
  column-count: 2;
}

Output

h1 {
  margin: 10px 20px;
}

h2 {
  columns: 12em 2;
}

Usage

See the PostCSS documentation for examples for your environment.

Browser support

A browser that does not know place-content, place-items or place-self ignores the whole declaration and loses both axes. The plugin therefore merges alignment longhands into these shorthands only when every browser in your Browserslist targets is known to support all three. A target without compatibility data, such as Opera Mini, counts as unsupported, so the Browserslist defaults query keeps the longhands.

The plugin accepts the Browserslist options overrideBrowserslist, stats, path and env. The browser build for the web has no access to your targets and assumes a fixed list that includes KaiOS, UC Browser and QQ Browser for Android, so it keeps the longhands.

Values that a target may not parse, such as safe, unsafe, last baseline, left, right, legacy, anchor-center and safe normal, merge only with a value that depends on the same keywords. A browser that lacks one of them drops the whole shorthand, where it would drop only one longhand.

The same holds for inset, the -block and -inline shorthands of margin, padding, inset, scroll-margin and scroll-padding, and the scroll-margin and scroll-padding shorthands, which arrived long after their longhands. The plugin creates or grows one only when every target supports it, and otherwise keeps the longhands. It still shortens a shorthand that is already there.

Writing modes

A flow-relative property such as margin-block-start sets a different physical side depending on the writing-mode and direction of the element, which any other rule may set. The plugin therefore never assumes either. It moves a declaration, or drops one that a later declaration overrides, only when the result is the same for every combination of the two. A physical declaration (margin-top) between a flow-relative one and its shorthand stops the move, and so does the legacy scroll-snap-margin-* spelling.

Contributors

See CONTRIBUTORS.md.

License

MIT © Ben Briggs