Port backgroundPosition module to plugin

This commit is contained in:
Adam Wathan 2019-01-09 21:48:27 -05:00
parent 6112b3e345
commit 0cd679b4ff
4 changed files with 17 additions and 17 deletions

View File

@ -1,3 +1,4 @@
import backgroundPosition from './plugins/backgroundPosition'
import backgroundRepeat from './plugins/backgroundRepeat'
import backgroundSize from './plugins/backgroundSize'
import borderCollapse from './plugins/borderCollapse'
@ -46,6 +47,7 @@ import zIndex from './plugins/zIndex'
export default function (config) {
return [
config.modules.backgroundPosition === false ? () => {} : backgroundPosition(),
config.modules.backgroundRepeat === false ? () => {} : backgroundRepeat(),
config.modules.backgroundSize === false ? () => {} : backgroundSize(),
config.modules.borderCollapse === false ? () => {} : borderCollapse(),

View File

@ -1,15 +0,0 @@
import defineClasses from '../util/defineClasses'
export default function() {
return defineClasses({
'bg-bottom': { 'background-position': 'bottom' },
'bg-center': { 'background-position': 'center' },
'bg-left': { 'background-position': 'left' },
'bg-left-bottom': { 'background-position': 'left bottom' },
'bg-left-top': { 'background-position': 'left top' },
'bg-right': { 'background-position': 'right' },
'bg-right-bottom': { 'background-position': 'right bottom' },
'bg-right-top': { 'background-position': 'right top' },
'bg-top': { 'background-position': 'top' },
})
}

View File

@ -0,0 +1,15 @@
export default function () {
return function ({ addUtilities, config }) {
addUtilities({
'.bg-bottom': { 'background-position': 'bottom' },
'.bg-center': { 'background-position': 'center' },
'.bg-left': { 'background-position': 'left' },
'.bg-left-bottom': { 'background-position': 'left bottom' },
'.bg-left-top': { 'background-position': 'left top' },
'.bg-right': { 'background-position': 'right' },
'.bg-right-bottom': { 'background-position': 'right bottom' },
'.bg-right-top': { 'background-position': 'right top' },
'.bg-top': { 'background-position': 'top' },
}, config('modules.backgroundPosition'))
}
}

View File

@ -2,12 +2,10 @@ import lists from './generators/lists'
import appearance from './generators/appearance'
import backgroundAttachment from './generators/backgroundAttachment'
import backgroundColors from './generators/backgroundColors'
import backgroundPosition from './generators/backgroundPosition'
export default [
{ name: 'lists', generator: lists },
{ name: 'appearance', generator: appearance },
{ name: 'backgroundAttachment', generator: backgroundAttachment },
{ name: 'backgroundColors', generator: backgroundColors },
{ name: 'backgroundPosition', generator: backgroundPosition },
]