Simplify defaultPlugins module
This commit is contained in:
parent
057b4ea767
commit
e120f59ed4
1 changed files with 59 additions and 54 deletions
|
|
@ -49,58 +49,63 @@ import whitespace from './plugins/whitespace'
|
|||
import width from './plugins/width'
|
||||
import zIndex from './plugins/zIndex'
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
export default function(config) {
|
||||
return [
|
||||
config.modules.lists === false ? () => {} : lists(),
|
||||
config.modules.appearance === false ? () => {} : appearance(),
|
||||
config.modules.backgroundAttachment === false ? () => {} : backgroundAttachment(),
|
||||
config.modules.backgroundColors === false ? () => {} : backgroundColors(),
|
||||
config.modules.backgroundPosition === false ? () => {} : backgroundPosition(),
|
||||
config.modules.backgroundRepeat === false ? () => {} : backgroundRepeat(),
|
||||
config.modules.backgroundSize === false ? () => {} : backgroundSize(),
|
||||
config.modules.borderCollapse === false ? () => {} : borderCollapse(),
|
||||
config.modules.borderColors === false ? () => {} : borderColors(),
|
||||
config.modules.borderRadius === false ? () => {} : borderRadius(),
|
||||
config.modules.borderStyle === false ? () => {} : borderStyle(),
|
||||
config.modules.borderWidths === false ? () => {} : borderWidths(),
|
||||
config.modules.cursor === false ? () => {} : cursor(),
|
||||
config.modules.display === false ? () => {} : display(),
|
||||
config.modules.flexbox === false ? () => {} : flexbox(),
|
||||
config.modules.float === false ? () => {} : float(),
|
||||
config.modules.fonts === false ? () => {} : fonts(),
|
||||
config.modules.fontWeights === false ? () => {} : fontWeights(),
|
||||
config.modules.height === false ? () => {} : height(),
|
||||
config.modules.leading === false ? () => {} : leading(),
|
||||
config.modules.margin === false ? () => {} : margin(),
|
||||
config.modules.maxHeight === false ? () => {} : maxHeight(),
|
||||
config.modules.maxWidth === false ? () => {} : maxWidth(),
|
||||
config.modules.minHeight === false ? () => {} : minHeight(),
|
||||
config.modules.minWidth === false ? () => {} : minWidth(),
|
||||
config.modules.negativeMargin === false ? () => {} : negativeMargin(),
|
||||
config.modules.objectFit === false ? () => {} : objectFit(),
|
||||
config.modules.objectPosition === false ? () => {} : objectPosition(),
|
||||
config.modules.opacity === false ? () => {} : opacity(),
|
||||
config.modules.outline === false ? () => {} : outline(),
|
||||
config.modules.overflow === false ? () => {} : overflow(),
|
||||
config.modules.padding === false ? () => {} : padding(),
|
||||
config.modules.pointerEvents === false ? () => {} : pointerEvents(),
|
||||
config.modules.position === false ? () => {} : position(),
|
||||
config.modules.resize === false ? () => {} : resize(),
|
||||
config.modules.shadows === false ? () => {} : shadows(),
|
||||
config.modules.svgFill === false ? () => {} : svgFill(),
|
||||
config.modules.svgStroke === false ? () => {} : svgStroke(),
|
||||
config.modules.tableLayout === false ? () => {} : tableLayout(),
|
||||
config.modules.textAlign === false ? () => {} : textAlign(),
|
||||
config.modules.textColors === false ? () => {} : textColors(),
|
||||
config.modules.textSizes === false ? () => {} : textSizes(),
|
||||
config.modules.textStyle === false ? () => {} : textStyle(),
|
||||
config.modules.tracking === false ? () => {} : tracking(),
|
||||
config.modules.userSelect === false ? () => {} : userSelect(),
|
||||
config.modules.verticalAlign === false ? () => {} : verticalAlign(),
|
||||
config.modules.visibility === false ? () => {} : visibility(),
|
||||
config.modules.whitespace === false ? () => {} : whitespace(),
|
||||
config.modules.width === false ? () => {} : width(),
|
||||
config.modules.zIndex === false ? () => {} : zIndex(),
|
||||
]
|
||||
function loadPlugins(modules, plugins) {
|
||||
return Object.keys(plugins)
|
||||
.filter(plugin => modules[plugin] !== false)
|
||||
.map(plugin => plugins[plugin]())
|
||||
}
|
||||
|
||||
export default function(config) {
|
||||
return loadPlugins(config.modules, {
|
||||
lists,
|
||||
appearance,
|
||||
backgroundAttachment,
|
||||
backgroundColors,
|
||||
backgroundPosition,
|
||||
backgroundRepeat,
|
||||
backgroundSize,
|
||||
borderCollapse,
|
||||
borderColors,
|
||||
borderRadius,
|
||||
borderStyle,
|
||||
borderWidths,
|
||||
cursor,
|
||||
display,
|
||||
flexbox,
|
||||
float,
|
||||
fonts,
|
||||
fontWeights,
|
||||
height,
|
||||
leading,
|
||||
margin,
|
||||
maxHeight,
|
||||
maxWidth,
|
||||
minHeight,
|
||||
minWidth,
|
||||
negativeMargin,
|
||||
objectFit,
|
||||
objectPosition,
|
||||
opacity,
|
||||
outline,
|
||||
overflow,
|
||||
padding,
|
||||
pointerEvents,
|
||||
position,
|
||||
resize,
|
||||
shadows,
|
||||
svgFill,
|
||||
svgStroke,
|
||||
tableLayout,
|
||||
textAlign,
|
||||
textColors,
|
||||
textSizes,
|
||||
textStyle,
|
||||
tracking,
|
||||
userSelect,
|
||||
verticalAlign,
|
||||
visibility,
|
||||
whitespace,
|
||||
width,
|
||||
zIndex,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue