From 06ef9557b309011bd265dde980791f422d8db58a Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Tue, 26 Feb 2019 10:30:44 -0500 Subject: [PATCH] Split flexGrow to separate plugin --- .../fixtures/tailwind-output-important.css | 40 +++++++++---------- __tests__/fixtures/tailwind-output.css | 40 +++++++++---------- defaultConfig.stub.js | 1 + src/corePlugins.js | 2 + src/plugins/flexGrow.js | 15 +++++++ src/plugins/flexbox.js | 6 --- 6 files changed, 58 insertions(+), 46 deletions(-) create mode 100644 src/plugins/flexGrow.js diff --git a/__tests__/fixtures/tailwind-output-important.css b/__tests__/fixtures/tailwind-output-important.css index 94c010dc6..412aafe6a 100644 --- a/__tests__/fixtures/tailwind-output-important.css +++ b/__tests__/fixtures/tailwind-output-important.css @@ -2851,6 +2851,10 @@ table { flex: none !important; } +.flex-grow-0 { + flex-grow: 0 !important; +} + .flex-grow { flex-grow: 1 !important; } @@ -2859,10 +2863,6 @@ table { flex-shrink: 1 !important; } -.flex-grow-0 { - flex-grow: 0 !important; -} - .flex-shrink-0 { flex-shrink: 0 !important; } @@ -8536,6 +8536,10 @@ table { flex: none !important; } + .sm\:flex-grow-0 { + flex-grow: 0 !important; + } + .sm\:flex-grow { flex-grow: 1 !important; } @@ -8544,10 +8548,6 @@ table { flex-shrink: 1 !important; } - .sm\:flex-grow-0 { - flex-grow: 0 !important; - } - .sm\:flex-shrink-0 { flex-shrink: 0 !important; } @@ -14206,6 +14206,10 @@ table { flex: none !important; } + .md\:flex-grow-0 { + flex-grow: 0 !important; + } + .md\:flex-grow { flex-grow: 1 !important; } @@ -14214,10 +14218,6 @@ table { flex-shrink: 1 !important; } - .md\:flex-grow-0 { - flex-grow: 0 !important; - } - .md\:flex-shrink-0 { flex-shrink: 0 !important; } @@ -19876,6 +19876,10 @@ table { flex: none !important; } + .lg\:flex-grow-0 { + flex-grow: 0 !important; + } + .lg\:flex-grow { flex-grow: 1 !important; } @@ -19884,10 +19888,6 @@ table { flex-shrink: 1 !important; } - .lg\:flex-grow-0 { - flex-grow: 0 !important; - } - .lg\:flex-shrink-0 { flex-shrink: 0 !important; } @@ -25546,6 +25546,10 @@ table { flex: none !important; } + .xl\:flex-grow-0 { + flex-grow: 0 !important; + } + .xl\:flex-grow { flex-grow: 1 !important; } @@ -25554,10 +25558,6 @@ table { flex-shrink: 1 !important; } - .xl\:flex-grow-0 { - flex-grow: 0 !important; - } - .xl\:flex-shrink-0 { flex-shrink: 0 !important; } diff --git a/__tests__/fixtures/tailwind-output.css b/__tests__/fixtures/tailwind-output.css index d8005d2c1..34bedaf5e 100644 --- a/__tests__/fixtures/tailwind-output.css +++ b/__tests__/fixtures/tailwind-output.css @@ -2851,6 +2851,10 @@ table { flex: none; } +.flex-grow-0 { + flex-grow: 0; +} + .flex-grow { flex-grow: 1; } @@ -2859,10 +2863,6 @@ table { flex-shrink: 1; } -.flex-grow-0 { - flex-grow: 0; -} - .flex-shrink-0 { flex-shrink: 0; } @@ -8536,6 +8536,10 @@ table { flex: none; } + .sm\:flex-grow-0 { + flex-grow: 0; + } + .sm\:flex-grow { flex-grow: 1; } @@ -8544,10 +8548,6 @@ table { flex-shrink: 1; } - .sm\:flex-grow-0 { - flex-grow: 0; - } - .sm\:flex-shrink-0 { flex-shrink: 0; } @@ -14206,6 +14206,10 @@ table { flex: none; } + .md\:flex-grow-0 { + flex-grow: 0; + } + .md\:flex-grow { flex-grow: 1; } @@ -14214,10 +14218,6 @@ table { flex-shrink: 1; } - .md\:flex-grow-0 { - flex-grow: 0; - } - .md\:flex-shrink-0 { flex-shrink: 0; } @@ -19876,6 +19876,10 @@ table { flex: none; } + .lg\:flex-grow-0 { + flex-grow: 0; + } + .lg\:flex-grow { flex-grow: 1; } @@ -19884,10 +19888,6 @@ table { flex-shrink: 1; } - .lg\:flex-grow-0 { - flex-grow: 0; - } - .lg\:flex-shrink-0 { flex-shrink: 0; } @@ -25546,6 +25546,10 @@ table { flex: none; } + .xl\:flex-grow-0 { + flex-grow: 0; + } + .xl\:flex-grow { flex-grow: 1; } @@ -25554,10 +25558,6 @@ table { flex-shrink: 1; } - .xl\:flex-grow-0 { - flex-grow: 0; - } - .xl\:flex-shrink-0 { flex-shrink: 0; } diff --git a/defaultConfig.stub.js b/defaultConfig.stub.js index 6f1af21c5..b2789c96f 100644 --- a/defaultConfig.stub.js +++ b/defaultConfig.stub.js @@ -26,6 +26,7 @@ module.exports = { justifyContent: ['responsive'], alignContent: ['responsive'], flex: ['responsive'], + flexGrow: ['responsive'], flexbox: ['responsive'], float: ['responsive'], fontFamily: ['responsive'], diff --git a/src/corePlugins.js b/src/corePlugins.js index 5e475d09b..a3d83ed9d 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -20,6 +20,7 @@ import alignSelf from './plugins/alignSelf' import justifyContent from './plugins/justifyContent' import alignContent from './plugins/alignContent' import flex from './plugins/flex' +import flexGrow from './plugins/flexGrow' import flexbox from './plugins/flexbox' import float from './plugins/float' import fontFamily from './plugins/fontFamily' @@ -101,6 +102,7 @@ export default function(config) { justifyContent, alignContent, flex, + flexGrow, flexbox, float, fontFamily, diff --git a/src/plugins/flexGrow.js b/src/plugins/flexGrow.js new file mode 100644 index 000000000..7deecc049 --- /dev/null +++ b/src/plugins/flexGrow.js @@ -0,0 +1,15 @@ +export default function({ variants }) { + return function({ addUtilities }) { + addUtilities( + { + '.flex-grow-0': { + 'flex-grow': '0', + }, + '.flex-grow': { + 'flex-grow': '1', + }, + }, + variants + ) + } +} diff --git a/src/plugins/flexbox.js b/src/plugins/flexbox.js index 36182fae1..543fe0fc7 100644 --- a/src/plugins/flexbox.js +++ b/src/plugins/flexbox.js @@ -2,15 +2,9 @@ export default function({ variants }) { return function({ addUtilities }) { addUtilities( { - '.flex-grow': { - 'flex-grow': '1', - }, '.flex-shrink': { 'flex-shrink': '1', }, - '.flex-grow-0': { - 'flex-grow': '0', - }, '.flex-shrink-0': { 'flex-shrink': '0', },