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

@spaced-out/postcss-flexbugs-strict

v1.0.2

Published

PostCSS plugin that tries to enforce unambiguous flexbox declarations

Downloads

51

Readme

PostCSS Flexbugs Strict

PostCSS plugin This project tries to encourage less ambiguous Flexbox CSS while fixing some of flexbug's issues.

Explanation

This started as a fork of postcss-flexbugs-fixes because I was not happy with some of the changes it made to support shorthand flex declarations. This is not the fault of that plugin (which is great!); it is an issue with the goal of supporting ambiguous declarations in browsers like IE and Safari. See https://github.com/luisrudge/postcss-flexbugs-fixes/issues/59

My solution was to change the goal. Instead of supporting declarations like flex: 100% 0; and flex: 1, we force users to declare all three values explicitly. Furthermore, we do not automatically translate any values from one unit to another. We force users to specify a unit that is compatible with all target browsers.

In my experience, most developers have no idea what the defaults of flex are let alone what flex: 1; means, and flex: 1 1 auto; is actually not much more code. It forces developers to think about exactly what they want.

Strict Behavior

flex declarations must contain 3 values.

Okay

.foo { flex: 1 0 0%; }

Bad

.foo { flex: 1; }

The grow and shrink values must be unit-less.

Bad

.foo { flex: 100% 1 0%; }

The basis value must have a unit, and cannot be 0px.

Bad

.foo { flex: 1 1 0px; }

Also bad

.foo { flex: 1 0 0; }

Translations

The calc check for flex-basis is benign so we still do it.

bug 8.1.a

Input

.foo { flex: 1 0 calc(1vw - 1px); }

Output

.foo {
  flex-grow: 1;
  flex-shrink: 0;
  flex-basis: calc(1vw - 1px);
}

Usage

postcss([require('@spaced-out/postcss-flexbugs-strict')]);

See PostCSS docs for examples for your environment.