Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Commit c7c89d1

Browse files
committed
Migrate backgroundSize
1 parent 0033b6f commit c7c89d1

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/corePlugins/backgroundSize.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
const nameClass = require('tailwindcss/lib/util/nameClass').default
22
const transformThemeValue = require('tailwindcss/lib/util/transformThemeValue').default
33

4-
module.exports = function ({ jit: { theme, addUtilities, addVariant, e } }) {
5-
addUtilities({
6-
bg: [
7-
(modifier, { theme }) => {
8-
if (
9-
modifier === undefined ||
10-
modifier === '' ||
11-
theme.backgroundSize[modifier] === undefined
12-
) {
13-
return []
14-
}
4+
module.exports = function ({ matchUtilities, jit: { theme } }) {
5+
matchUtilities({
6+
bg: (modifier, { theme }) => {
7+
let value = theme.backgroundSize[modifier]
8+
if (value === undefined) {
9+
return []
10+
}
1511

16-
return [[nameClass('bg', modifier), { 'background-size': theme.backgroundSize[modifier] }]]
17-
},
18-
],
12+
return { [nameClass('bg', modifier)]: { 'background-size': value } }
13+
},
1914
})
2015
}

0 commit comments

Comments
 (0)