From cce1a090357cf6e817c1788bd64956d2ff012faf Mon Sep 17 00:00:00 2001 From: Maksym Kupriichuk Date: Sat, 16 May 2020 16:51:06 +0300 Subject: [PATCH] add flexbox --- lib/properties.js | 5 +++++ lib/shorthanders/flex.js | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 lib/shorthanders/flex.js diff --git a/lib/properties.js b/lib/properties.js index d8f3583..be34dc0 100644 --- a/lib/properties.js +++ b/lib/properties.js @@ -24,6 +24,11 @@ module.exports = [{ properties: ['border-width', 'border-style', 'border-color'], shorthandSyntax: 'border-width border-style border-color', getShorthandValue: require('./shorthanders/border') +}, { + shorthandProperty: 'flex', + properties: ['flex-grow', 'flex-shrink', 'flex-basis'], + shorthandSyntax: 'flex-grow flex-shrink flex-basis', + getShorthandValue: require('./shorthanders/flex') }, { shorthandProperty: 'outline', properties: ['outline-width', 'outline-style', 'outline-color'], diff --git a/lib/shorthanders/flex.js b/lib/shorthanders/flex.js new file mode 100644 index 0000000..5123e30 --- /dev/null +++ b/lib/shorthanders/flex.js @@ -0,0 +1,9 @@ +module.exports = function(shorthand, declarations) { + var shorthandValue = require('./generic')(shorthand, declarations); + + if (!declarations['flex-grow'] || !declarations['flex-shrink']) { + return ''; + } + + return shorthandValue.replace(' ', ' ').trim(); +}; \ No newline at end of file