mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Port minWidth module to plugin
This commit is contained in:
parent
1ff01435e7
commit
b140bf66fb
@ -1,3 +1,4 @@
|
||||
import minWidth from './plugins/minWidth'
|
||||
import negativeMargin from './plugins/negativeMargin'
|
||||
import objectFit from './plugins/objectFit'
|
||||
import objectPosition from './plugins/objectPosition'
|
||||
@ -26,6 +27,7 @@ import zIndex from './plugins/zIndex'
|
||||
|
||||
export default function (config) {
|
||||
return [
|
||||
config.modules.minWidth === false ? () => {} : minWidth(),
|
||||
config.modules.negativeMargin === false ? () => {} : negativeMargin(),
|
||||
config.modules.objectFit === false ? () => {} : objectFit(),
|
||||
config.modules.objectPosition === false ? () => {} : objectPosition(),
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
import _ from 'lodash'
|
||||
import defineClass from '../util/defineClass'
|
||||
|
||||
function defineMinWidths(widths) {
|
||||
return _.map(widths, (size, modifer) => {
|
||||
return defineClass(`min-w-${modifer}`, {
|
||||
'min-width': `${size}`,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default function(config) {
|
||||
return _.flatten([defineMinWidths(config.minWidth)])
|
||||
}
|
||||
13
src/plugins/minWidth.js
Normal file
13
src/plugins/minWidth.js
Normal file
@ -0,0 +1,13 @@
|
||||
import _ from 'lodash'
|
||||
|
||||
export default function () {
|
||||
return function ({ addUtilities, config, e }) {
|
||||
const utilities = _.fromPairs(_.map(config('minWidth'), (value, modifier) => {
|
||||
return [`.${e(`min-w-${modifier}`)}`, {
|
||||
'min-width': value,
|
||||
}]
|
||||
}))
|
||||
|
||||
addUtilities(utilities, config('modules.minWidth'))
|
||||
}
|
||||
}
|
||||
@ -22,7 +22,6 @@ import margin from './generators/margin'
|
||||
import maxHeight from './generators/maxHeight'
|
||||
import maxWidth from './generators/maxWidth'
|
||||
import minHeight from './generators/minHeight'
|
||||
import minWidth from './generators/minWidth'
|
||||
|
||||
export default [
|
||||
{ name: 'lists', generator: lists },
|
||||
@ -49,5 +48,4 @@ export default [
|
||||
{ name: 'maxHeight', generator: maxHeight },
|
||||
{ name: 'maxWidth', generator: maxWidth },
|
||||
{ name: 'minHeight', generator: minHeight },
|
||||
{ name: 'minWidth', generator: minWidth },
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user