From 4f20e968c1107ebb2a12f8261d0f2d35a1b81ce2 Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Fri, 15 Mar 2019 07:54:28 -0400 Subject: [PATCH] Split wordBreak plugin from whitespace plugin --- defaultConfig.stub.js | 1 + src/corePlugins.js | 2 ++ src/plugins/whitespace.js | 13 ------------- src/plugins/wordBreak.js | 21 +++++++++++++++++++++ 4 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 src/plugins/wordBreak.js diff --git a/defaultConfig.stub.js b/defaultConfig.stub.js index 9f1c37fdf..06a6d4f0d 100644 --- a/defaultConfig.stub.js +++ b/defaultConfig.stub.js @@ -67,6 +67,7 @@ module.exports = { verticalAlign: ['responsive'], visibility: ['responsive'], whitespace: ['responsive'], + wordBreak: ['responsive'], width: ['responsive'], zIndex: ['responsive'], }, diff --git a/src/corePlugins.js b/src/corePlugins.js index 6463ec0da..942750913 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -61,6 +61,7 @@ import userSelect from './plugins/userSelect' import verticalAlign from './plugins/verticalAlign' import visibility from './plugins/visibility' import whitespace from './plugins/whitespace' +import wordBreak from './plugins/wordBreak' import width from './plugins/width' import zIndex from './plugins/zIndex' @@ -131,6 +132,7 @@ export default function({ corePlugins: corePluginConfig }) { verticalAlign, visibility, whitespace, + wordBreak, width, zIndex, }) diff --git a/src/plugins/whitespace.js b/src/plugins/whitespace.js index d64613781..b4df70916 100644 --- a/src/plugins/whitespace.js +++ b/src/plugins/whitespace.js @@ -7,19 +7,6 @@ export default function() { '.whitespace-pre': { 'white-space': 'pre' }, '.whitespace-pre-line': { 'white-space': 'pre-line' }, '.whitespace-pre-wrap': { 'white-space': 'pre-wrap' }, - - '.break-normal': { - 'overflow-wrap': 'normal', - 'word-break': 'normal', - }, - '.break-words': { 'overflow-wrap': 'break-word' }, - '.break-all': { 'word-break': 'break-all' }, - - '.truncate': { - overflow: 'hidden', - 'text-overflow': 'ellipsis', - 'white-space': 'nowrap', - }, }, config('variants.whitespace') ) diff --git a/src/plugins/wordBreak.js b/src/plugins/wordBreak.js new file mode 100644 index 000000000..887c817df --- /dev/null +++ b/src/plugins/wordBreak.js @@ -0,0 +1,21 @@ +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.break-normal': { + 'overflow-wrap': 'normal', + 'word-break': 'normal', + }, + '.break-words': { 'overflow-wrap': 'break-word' }, + '.break-all': { 'word-break': 'break-all' }, + + '.truncate': { + overflow: 'hidden', + 'text-overflow': 'ellipsis', + 'white-space': 'nowrap', + }, + }, + config('variants.wordBreak') + ) + } +}