Port width and whitespace modules to plugins
This commit is contained in:
parent
6352843cde
commit
027b69c7e8
7 changed files with 39 additions and 140 deletions
20
src/plugins/whitespace.js
Normal file
20
src/plugins/whitespace.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
export default function () {
|
||||
return function ({ addUtilities, config }) {
|
||||
addUtilities({
|
||||
'.whitespace-normal': { 'white-space': 'normal' },
|
||||
'.whitespace-no-wrap': { 'white-space': 'nowrap' },
|
||||
'.whitespace-pre': { 'white-space': 'pre' },
|
||||
'.whitespace-pre-line': { 'white-space': 'pre-line' },
|
||||
'.whitespace-pre-wrap': { 'white-space': 'pre-wrap' },
|
||||
|
||||
'.break-words': { 'word-wrap': 'break-word' },
|
||||
'.break-normal': { 'word-wrap': 'normal' },
|
||||
|
||||
'.truncate': {
|
||||
overflow: 'hidden',
|
||||
'text-overflow': 'ellipsis',
|
||||
'white-space': 'nowrap',
|
||||
},
|
||||
}, config('modules.whitespace'))
|
||||
}
|
||||
}
|
||||
13
src/plugins/width.js
Normal file
13
src/plugins/width.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import _ from 'lodash'
|
||||
|
||||
export default function () {
|
||||
return function ({ addUtilities, config, e }) {
|
||||
const utilities = _.fromPairs(_.map(config('width'), (value, modifier) => {
|
||||
return [`.${e(`w-${modifier}`)}`, {
|
||||
'width': value,
|
||||
}]
|
||||
}))
|
||||
|
||||
addUtilities(utilities, config('modules.width'))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue