katoikia-app/web-ui/web-react/node_modules/postcss-flexbugs-fixes/bugs/bug6.js

16 lines
698 B
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
var postcss = require('postcss');
module.exports = function(decl) {
if (decl.prop === 'flex') {
var values = postcss.list.space(decl.value);
var flexGrow = values[0];
var flexShrink = values[1] || '1';
var flexBasis = values[2] || '0%';
// Safari seems to hate '0%' and the others seems to make do with a nice value when basis is missing,
// so if we see a '0%', just remove it. This way it'll get adjusted for any other cases where '0%' is
// already defined somewhere else.
if(flexBasis === '0%') flexBasis = null;
decl.value = flexGrow + ' ' + flexShrink + (flexBasis ? ' ' + flexBasis : '');
}
};