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

Commit 9bcfee3

Browse files
committed
Move animation plugin to new format
1 parent bc2d79f commit 9bcfee3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/corePlugins/animation.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
const nameClass = require('tailwindcss/lib/util/nameClass').default
22
const transformThemeValue = require('tailwindcss/lib/util/transformThemeValue').default
33
const parseAnimationValue = require('tailwindcss/lib/util/parseAnimationValue').default
4+
const { newFormat } = require('../pluginUtils')
45

56
module.exports = function ({ jit: { theme, addUtilities } }) {
67
let keyframes = Object.fromEntries(
78
Object.entries(theme.keyframes).map(([key, value]) => {
89
return [
910
key,
1011
[
11-
`@keyframes ${key}`,
12-
Object.entries(value).map(([key, value]) => {
13-
return [key, value]
14-
}),
12+
{
13+
[`@keyframes ${key}`]: value,
14+
},
15+
{ respectVariants: false },
1516
],
16-
{ respectVariants: false },
1717
]
1818
})
1919
)
2020

2121
let transformValue = transformThemeValue('animation')
2222
addUtilities({
2323
animate: [
24-
(modifier, { theme }) => {
24+
newFormat((modifier, { theme }) => {
2525
let value = transformValue(theme.animation[modifier])
2626

2727
if (modifier === '' || value === undefined) {
@@ -30,8 +30,11 @@ module.exports = function ({ jit: { theme, addUtilities } }) {
3030

3131
let { name: animationName } = parseAnimationValue(value)
3232

33-
return [keyframes[animationName], [nameClass('animate', modifier), { animation: value }]]
34-
},
33+
return [
34+
keyframes[animationName],
35+
{ [nameClass('animate', modifier)]: { animation: value } },
36+
]
37+
}),
3538
],
3639
})
3740
}

0 commit comments

Comments
 (0)