Split wordBreak plugin from whitespace plugin

This commit is contained in:
Adam Wathan 2019-03-15 07:54:28 -04:00
parent 8fa379a995
commit 4f20e968c1
4 changed files with 24 additions and 13 deletions

View File

@ -67,6 +67,7 @@ module.exports = {
verticalAlign: ['responsive'],
visibility: ['responsive'],
whitespace: ['responsive'],
wordBreak: ['responsive'],
width: ['responsive'],
zIndex: ['responsive'],
},

View File

@ -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,
})

View File

@ -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')
)

21
src/plugins/wordBreak.js Normal file
View File

@ -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')
)
}
}