From a2337e6cc85ab9e97a22ab1389f3ed911255248f Mon Sep 17 00:00:00 2001 From: Twentylives Date: Sun, 18 Oct 2020 22:44:10 +0300 Subject: [PATCH] Simplifying animation utilities generation (#2606) --- src/plugins/animation.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/plugins/animation.js b/src/plugins/animation.js index aaf503b21..6a8306742 100644 --- a/src/plugins/animation.js +++ b/src/plugins/animation.js @@ -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')) }