Skip to content

luisrudge/postcss-flexbugs-fixes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

683560e · Feb 7, 2021

History

76 Commits
Apr 27, 2020
Oct 31, 2020
Feb 9, 2020
Jun 10, 2015
Jun 10, 2015
Feb 4, 2020
Nov 20, 2020
Feb 7, 2021
Jun 10, 2015
Jul 30, 2018
Feb 4, 2020
Oct 31, 2020
Nov 20, 2020
Oct 31, 2020

Repository files navigation

PostCSS Flexbugs Fixes Build Status

PostCSS plugin This project tries to fix all of flexbug's issues.

bug 4

Input

.foo { flex: 1; }
.bar { flex: 1 1; }
.foz { flex: 1 1 0; }
.baz { flex: 1 1 0px; }

Output

.foo { flex: 1 1; }
.bar { flex: 1 1; }
.foz { flex: 1 1; }
.baz { flex: 1 1; }

bug 6

Input

.foo { flex: 1; }

Output

.foo { flex: 1 1 0%; }

This only fixes css classes that have the flex property set. To fix elements that are contained inside a flexbox container, use this global rule:

* {
    flex-shrink: 1;
}

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('postcss-flexbugs-fixes')]);

You can also disable bugs individually, possible keys bug4, bug6 and bug8a.

var plugin = require('postcss-flexbugs-fixes');
postcss([plugin({ bug6: false })]);

See PostCSS docs for examples for your environment.