mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Port backgroundSize module to plugin
This commit is contained in:
parent
96439a33e6
commit
5a372877a6
@ -1,3 +1,4 @@
|
||||
import backgroundSize from './plugins/backgroundSize'
|
||||
import borderCollapse from './plugins/borderCollapse'
|
||||
import borderColors from './plugins/borderColors'
|
||||
import borderRadius from './plugins/borderRadius'
|
||||
@ -44,6 +45,7 @@ import zIndex from './plugins/zIndex'
|
||||
|
||||
export default function (config) {
|
||||
return [
|
||||
config.modules.backgroundSize === false ? () => {} : backgroundSize(),
|
||||
config.modules.borderCollapse === false ? () => {} : borderCollapse(),
|
||||
config.modules.borderColors === false ? () => {} : borderColors(),
|
||||
config.modules.borderRadius === false ? () => {} : borderRadius(),
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
import _ from 'lodash'
|
||||
import defineClass from '../util/defineClass'
|
||||
|
||||
export default function({ backgroundSize }) {
|
||||
return _.map(backgroundSize, (size, className) => {
|
||||
return defineClass(`bg-${className}`, {
|
||||
'background-size': size,
|
||||
})
|
||||
})
|
||||
}
|
||||
13
src/plugins/backgroundSize.js
Normal file
13
src/plugins/backgroundSize.js
Normal file
@ -0,0 +1,13 @@
|
||||
import _ from 'lodash'
|
||||
|
||||
export default function () {
|
||||
return function ({ addUtilities, config, e }) {
|
||||
const utilities = _.fromPairs(_.map(config('backgroundSize'), (value, modifier) => {
|
||||
return [`.${e(`bg-${modifier}`)}`, {
|
||||
'background-size': value,
|
||||
}]
|
||||
}))
|
||||
|
||||
addUtilities(utilities, config('modules.opacity'))
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,6 @@ import backgroundAttachment from './generators/backgroundAttachment'
|
||||
import backgroundColors from './generators/backgroundColors'
|
||||
import backgroundPosition from './generators/backgroundPosition'
|
||||
import backgroundRepeat from './generators/backgroundRepeat'
|
||||
import backgroundSize from './generators/backgroundSize'
|
||||
|
||||
export default [
|
||||
{ name: 'lists', generator: lists },
|
||||
@ -13,5 +12,4 @@ export default [
|
||||
{ name: 'backgroundColors', generator: backgroundColors },
|
||||
{ name: 'backgroundPosition', generator: backgroundPosition },
|
||||
{ name: 'backgroundRepeat', generator: backgroundRepeat },
|
||||
{ name: 'backgroundSize', generator: backgroundSize },
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user