postcss-flexbugs-fixes

A PostCSS plugin that automatically fixes common cross-browser Flexbox layout bugs.

Library
npm
v5.0.2
742stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
40/100Fair
Development Activity0
Maintenance20
Community52
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
58/100Fair
Architecture72
Code Quality55
Innovation60
Learning Curve45

postcss-flexbugs-fixes is a small, focused PostCSS plugin that patches CSS output to work around the well-documented “flexbugs” — a set of inconsistent flexbox behaviors across browser implementations. It targets three specific issues: unitless flex-basis values being dropped from flex shorthand (bug #4), the changed default flex-basis behavior that trips up Safari (bug #6), and flex-basis’s lack of calc() support in older Safari (bug #8.1.a). Each fix is implemented as an isolated transform under bugs/, applied to every flex declaration during the PostCSS build step.

Because flexbox cross-browser quirks are notoriously hard to track down by hand, this plugin became a near-default inclusion in JavaScript build tooling — most notably bundled into Create React App’s PostCSS pipeline, giving it reach far beyond its direct npm install count. It ships with per-bug toggles (bug4, bug6, bug8a), skips flex values that reference CSS custom properties to avoid breaking dynamic theming, and requires postcss ^8.1.4 as a peer dependency rather than bundling its own copy.

What You Get

  • Three targeted bug fixes - Rewrites flex shorthand for bug #4 (unitless flex-basis dropped), bug #6 (changed default basis), and bug #8.1.a (calc() unsupported in flex-basis).
  • Per-bug opt-out flags - bug4, bug6, and bug8a options let consumers selectively disable any individual fix.
  • Safe custom-property handling - Skips rewriting any flex value that references a CSS custom property (var(...)) so dynamic theming isn’t broken.
  • Zero-config drop-in - Works with sensible defaults out of the box; just add it to a PostCSS plugin array with no options required.

Common Use Cases

  • Cross-browser flexbox layouts - Teams shipping layouts built with flex shorthand who need consistent rendering in Safari and older browsers without hand-writing longhand properties.
  • Create React App-style build pipelines - Projects that inherited this plugin as part of a bundled PostCSS config (e.g. CRA) and want to understand or tune what it’s doing.
  • Selective bug patching - Projects affected by only one of the three flexbugs, disabling the others via the bug4/bug6/bug8a options.

Under The Hood

Architecture The plugin exports a single factory function (index.js) that merges user options with defaults (bug4, bug6, bug81a all true) and returns a PostCSS plugin object using the Once visitor API from PostCSS 8. Inside, it walks every declaration via css.walkDecls, short-circuiting on values containing var( or equal to none, then conditionally invokes three independent transform modules (bugs/bug4.js, bugs/bug6.js, bugs/bug81a.js), each a pure function operating on a single declaration node in place. There’s no shared state between the three fixes and no build step — the whole surface area is one entry point plus three sibling files, so changing one fix has no effect on the others.

Tech Stack Plain CommonJS JavaScript with no transpilation step; it depends only on postcss (^8.1.4) as a peer dependency, meaning consumers supply their own PostCSS instance. Dev tooling is dated — gulp plus gulp-mocha and gulp-eslint drive the npm test script, chai provides assertions, and .travis.yml still targets Node 15 on Travis CI. There is no bundler, no TypeScript, and only a yarn.lock (no npm lockfile); files in package.json ships just bugs/ and index.js to consumers.

Code Quality Tests live under specs/ using a shared test.js helper that runs each fixture through postcss([plugin(opts)]).process(...) and asserts on result.css with Chai’s expect, covering all three bug fixes plus a pluginSpec.js and regressiveSpecs.js for regression fixtures — a real, if old-school, test suite (Mocha via gulp-mocha) with reasonable edge-case coverage (unitless basis, calc(), var()). There are no type annotations or shipped type definitions, error handling is minimal (no validation of malformed input, relying on PostCSS’s own parser), naming is short but consistent (bug4, bug6, bug81a mirroring the flexbugs issue numbers), and CI runs on Travis, a largely dormant service today, so automated checks on new PRs are questionable.

API Design The public API is a single factory function matching PostCSS’s plugin convention exactly (plugin(opts) returning {postcssPlugin, Once}), so integration is a one-liner in any postcss.config.js with zero required configuration — defaults fix all three bugs immediately. The only configuration surface is three boolean flags mirroring the underlying flexbugs issue numbers, easy to discover from the README’s per-bug documentation but assuming familiarity with PostCSS’s own plugin-array wiring. No TypeScript types are shipped, so option and return shapes rely entirely on the README and PostCSS’s own conventions for discoverability.

Used by 9 apps in this directory

TypeScript
68%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,825

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
93
Repo Health
79
Technical
66
Dependency
Built with
TypeScript68%
Java21%
Updated 3 days ago
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,640

Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.

View details
69
Repo Health
76
Technical
62
Dependency
Built with
JavaScript90%
Updated 1 weeks ago
Ruby
63%
AGPL 3.0

Forem

Community · Blogging

22,775

Open source Ruby on Rails platform for building developer communities with articles, discussions, and social profiles—the same software that powers dev.to.

View details
83
Repo Health
79
Technical
67
Dependency
Built with
Ruby63%
JavaScript19%
HTML13%
Updated 2 days ago
TypeScript
94%
AGPL 3.0

Laudspeaker

Marketing · Automation

2,620

Open-source customer engagement platform for building visual, event-triggered messaging journeys across email, SMS, push, in-app, and webhooks.

View details
51
Repo Health
66
Technical
62
Dependency
Built with
TypeScript94%
Updated 1 months ago
Go
50%
Apache 2.0

opencloud

File Storage

5,902

Open source file management and collaboration platform that keeps your data under your control, no database required.

View details
85
Repo Health
80
Technical
69
Dependency
Built with
Go50%
Gherkin35%
PHP12%
Updated yesterday
TypeScript
97%
Other

Rocket.Chat

Team Chat

46,089

The secure, self-hosted team communications platform for organizations that cannot compromise on data sovereignty.

View details
96
Repo Health
79
Technical
66
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
99%
Other

Teable

Databases · No Code Platforms

21,759

A no-code PostgreSQL database with spreadsheet UX, real-time collaboration, and native AI agents — built for teams that outgrow Airtable.

View details
79
Repo Health
76
Technical
63
Dependency
Built with
TypeScript99%
Updated today
TypeScript
98%
MIT

Umami

Analytics

38,642

Privacy-first web analytics that respects your users — self-hosted, cookieless, and GDPR compliant out of the box.

View details
95
Repo Health
83
Technical
70
Dependency
Built with
TypeScript98%
Updated yesterday
Vue
47%
AGPL 3.0

Wiki.js

Knowledge Management · Collaboration

28,848

A modern, self-hosted wiki platform built on Node.js with a rich plugin ecosystem for authentication, search, storage, and rendering that adapts to any team's infrastructure.

View details
72
Repo Health
67
Technical
60
Dependency
Built with
Vue47%
JavaScript42%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search