Port display module to plugin

This commit is contained in:
Adam Wathan 2019-01-09 21:26:12 -05:00
parent fd1729ec81
commit a493ee420d
4 changed files with 29 additions and 29 deletions

View file

@ -1,3 +1,4 @@
import display from './plugins/display'
import flexbox from './plugins/flexbox'
import float from './plugins/float'
import fonts from './plugins/fonts'
@ -37,6 +38,7 @@ import zIndex from './plugins/zIndex'
export default function (config) {
return [
config.modules.display === false ? () => {} : display(),
config.modules.flexbox === false ? () => {} : flexbox(),
config.modules.float === false ? () => {} : float(),
config.modules.fonts === false ? () => {} : fonts(),

View file

@ -1,27 +0,0 @@
import defineClasses from '../util/defineClasses'
export default function() {
return defineClasses({
block: {
display: 'block',
},
'inline-block': {
display: 'inline-block',
},
inline: {
display: 'inline',
},
table: {
display: 'table',
},
'table-row': {
display: 'table-row',
},
'table-cell': {
display: 'table-cell',
},
hidden: {
display: 'none',
},
})
}

27
src/plugins/display.js Normal file
View file

@ -0,0 +1,27 @@
export default function () {
return function ({ addUtilities, config }) {
addUtilities({
'.block': {
display: 'block',
},
'.inline-block': {
display: 'inline-block',
},
'.inline': {
display: 'inline',
},
'.table': {
display: 'table',
},
'.table-row': {
display: 'table-row',
},
'.table-cell': {
display: 'table-cell',
},
'.hidden': {
display: 'none',
},
}, config('modules.display'))
}
}

View file

@ -11,7 +11,6 @@ import borderRadius from './generators/borderRadius'
import borderStyle from './generators/borderStyle'
import borderWidths from './generators/borderWidths'
import cursor from './generators/cursor'
import display from './generators/display'
export default [
{ name: 'lists', generator: lists },
@ -27,5 +26,4 @@ export default [
{ name: 'borderStyle', generator: borderStyle },
{ name: 'borderWidths', generator: borderWidths },
{ name: 'cursor', generator: cursor },
{ name: 'display', generator: display },
]