diff --git a/src/defaultPlugins.js b/src/defaultPlugins.js index f7a6ee6c2..1d6532522 100644 --- a/src/defaultPlugins.js +++ b/src/defaultPlugins.js @@ -1,3 +1,4 @@ +import objectPosition from './plugins/objectPosition' import opacity from './plugins/opacity' import outline from './plugins/outline' import overflow from './plugins/overflow' @@ -21,27 +22,30 @@ import whitespace from './plugins/whitespace' import width from './plugins/width' import zIndex from './plugins/zIndex' -export default [ - opacity(), - outline(), - overflow(), - padding(), - pointerEvents(), - position(), - resize(), - shadows(), - svgFill(), - svgStroke(), - tableLayout(), - textAlign(), - textColors(), - textSizes(), - textStyle(), - tracking(), - userSelect(), - verticalAlign(), - visibility(), - whitespace(), - width(), - zIndex(), -] +export default function (config) { + return [ + 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(), + ] +} diff --git a/src/generators/objectPosition.js b/src/generators/objectPosition.js deleted file mode 100644 index df8863099..000000000 --- a/src/generators/objectPosition.js +++ /dev/null @@ -1,15 +0,0 @@ -import defineClasses from '../util/defineClasses' - -export default function() { - return defineClasses({ - 'object-bottom': { 'object-position': 'bottom' }, - 'object-center': { 'object-position': 'center' }, - 'object-left': { 'object-position': 'left' }, - 'object-left-bottom': { 'object-position': 'left bottom' }, - 'object-left-top': { 'object-position': 'left top' }, - 'object-right': { 'object-position': 'right' }, - 'object-right-bottom': { 'object-position': 'right bottom' }, - 'object-right-top': { 'object-position': 'right top' }, - 'object-top': { 'object-position': 'top' }, - }) -} diff --git a/src/plugins/objectPosition.js b/src/plugins/objectPosition.js new file mode 100644 index 000000000..d89830d2d --- /dev/null +++ b/src/plugins/objectPosition.js @@ -0,0 +1,15 @@ +export default function () { + return function ({ addUtilities, config }) { + addUtilities({ + '.object-bottom': { 'object-position': 'bottom' }, + '.object-center': { 'object-position': 'center' }, + '.object-left': { 'object-position': 'left' }, + '.object-left-bottom': { 'object-position': 'left bottom' }, + '.object-left-top': { 'object-position': 'left top' }, + '.object-right': { 'object-position': 'right' }, + '.object-right-bottom': { 'object-position': 'right bottom' }, + '.object-right-top': { 'object-position': 'right top' }, + '.object-top': { 'object-position': 'top' }, + }, config('modules.objectPosition')) + } +} diff --git a/src/processTailwindFeatures.js b/src/processTailwindFeatures.js index e704938cf..189df0bdb 100644 --- a/src/processTailwindFeatures.js +++ b/src/processTailwindFeatures.js @@ -17,7 +17,7 @@ export default function(getConfig) { return function(css) { const config = getConfig() const processedPlugins = processPlugins([ - ...defaultPlugins, + ...defaultPlugins(config), ...config.plugins ], config) const utilities = generateUtilities(config, processedPlugins.utilities) diff --git a/src/utilityModules.js b/src/utilityModules.js index 9065304bd..72c723519 100644 --- a/src/utilityModules.js +++ b/src/utilityModules.js @@ -25,7 +25,6 @@ import minHeight from './generators/minHeight' import minWidth from './generators/minWidth' import negativeMargin from './generators/negativeMargin' import objectFit from './generators/objectFit' -import objectPosition from './generators/objectPosition' export default [ { name: 'lists', generator: lists }, @@ -55,5 +54,4 @@ export default [ { name: 'minWidth', generator: minWidth }, { name: 'negativeMargin', generator: negativeMargin }, { name: 'objectFit', generator: objectFit }, - { name: 'objectPosition', generator: objectPosition }, ]