Simplifying animation utilities generation (#2606)
This commit is contained in:
parent
44f2c54605
commit
a2337e6cc8
1 changed files with 4 additions and 14 deletions
|
|
@ -4,23 +4,13 @@ import nameClass from '../util/nameClass'
|
|||
export default function () {
|
||||
return function ({ addUtilities, theme, variants }) {
|
||||
const keyframesConfig = theme('keyframes')
|
||||
const keyframesStyles = _.fromPairs(
|
||||
_.toPairs(keyframesConfig).map(([name, keyframes]) => {
|
||||
return [`@keyframes ${name}`, keyframes]
|
||||
})
|
||||
)
|
||||
const keyframesStyles = _.mapKeys(keyframesConfig, (_keyframes, name) => `@keyframes ${name}`)
|
||||
addUtilities(keyframesStyles, { respectImportant: false })
|
||||
|
||||
const animationConfig = theme('animation')
|
||||
const utilities = _.fromPairs(
|
||||
_.toPairs(animationConfig).map(([suffix, animation]) => {
|
||||
return [
|
||||
nameClass('animate', suffix),
|
||||
{
|
||||
animation,
|
||||
},
|
||||
]
|
||||
})
|
||||
const utilities = _.mapValues(
|
||||
_.mapKeys(animationConfig, (_animation, suffix) => nameClass('animate', suffix)),
|
||||
(animation) => ({ animation })
|
||||
)
|
||||
addUtilities(utilities, variants('animation'))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue