<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Divyansh Singh</title>
    <description>The latest articles on DEV Community by Divyansh Singh (@brc_dd).</description>
    <link>https://dev.to/brc_dd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F646644%2Facdff361-09be-44cb-bba6-134f0895dd9c.jpeg</url>
      <title>DEV Community: Divyansh Singh</title>
      <link>https://dev.to/brc_dd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/brc_dd"/>
    <language>en</language>
    <item>
      <title>Animate.css with Tailwind CSS</title>
      <dc:creator>Divyansh Singh</dc:creator>
      <pubDate>Wed, 09 Jun 2021 17:33:27 +0000</pubDate>
      <link>https://dev.to/brc_dd/animate-css-with-tailwind-css-klb</link>
      <guid>https://dev.to/brc_dd/animate-css-with-tailwind-css-klb</guid>
      <description>&lt;p&gt;If you have used &lt;a href="https://tailwindcss.com/"&gt;Tailwind CSS&lt;/a&gt;, you might have noticed that it lacks proper animation utilities. It has only &lt;a href="https://tailwindcss.com/docs/animation"&gt;four animations&lt;/a&gt; by default - spin, ping, pulse, and bounce. This limitation makes us search for other methods and additional frameworks to animate the components. The most common one is &lt;a href="https://github.com/animate-css/animate.css"&gt;Animate.css&lt;/a&gt; if you don't want to write all the keyframes yourself.&lt;/p&gt;

&lt;p&gt;Animate.css (like Tailwind CSS) provides &lt;a href="https://animate.style/"&gt;animation utility classes&lt;/a&gt; and works nicely alongside Tailwind. But since it is just a pure CSS library, it lacks Tailwind features like variants, directives, purging, and even editor tools like &lt;a href="https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss"&gt;Tailwind Intellisense&lt;/a&gt;. But what if you can make Tailwind know about the animation classes provided by Animate.css? &lt;/p&gt;

&lt;p&gt;The question will probably make you search for some plugin, and the first one on the list will be &lt;a href="https://github.com/bentzibentz/tailwindcss-animate.css"&gt;&lt;code&gt;tailwindcss-animatecss&lt;/code&gt;&lt;/a&gt;. It is a great plugin in itself, except it requires quite a configuration. Although its adjustable (optional) settings are pretty nice, but setting the variants and required classes seems overkill in the new &lt;a href="https://tailwindcss.com/docs/just-in-time-mode"&gt;JIT mode&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So, I wrote a configuration myself – &lt;a href="https://www.npmjs.com/package/animated-tailwindcss"&gt;&lt;code&gt;animated-tailwindcss&lt;/code&gt;&lt;/a&gt;. To use the configuration, you just need to install it, import it, and wrap your existing configuration with it. After being properly configured, you can use the animation utilities of Animate.css as if they are a part of the Tailwind CSS! &lt;/p&gt;

&lt;p&gt;All your variants will work with the animation classes. You can use them inside the directives like &lt;a href="https://tailwindcss.com/docs/functions-and-directives#apply"&gt;&lt;code&gt;@apply&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://tailwindcss.com/docs/functions-and-directives#screen"&gt;&lt;code&gt;@screen&lt;/code&gt;&lt;/a&gt;. Also, you will not have &lt;a href="https://tailwindcss.com/docs/optimizing-for-production#removing-unused-keyframes"&gt;extra keyframes&lt;/a&gt; emitted to the code in production, and in development, you can use the Tailwind Intellisense without any extra configuration! The animation classes are &lt;a href="https://tailwindcss.com/docs/hover-focus-and-other-states#motion-safe"&gt;motion-safe&lt;/a&gt; by default, i.e., animations will be disabled if the user &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion"&gt;prefers reduced motion&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Please give the configuration a try. If you feel that something went wrong, please comment or create an issue on &lt;a href="https://github.com/ikcb/animated-tailwindcss/issues"&gt;GitHub&lt;/a&gt;. I am working on adding options to customize duration, delay, etc. They will be available soon!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt; that the only difference you will notice if you have used Animate.css earlier is that you need to reference the class names with the prefix &lt;code&gt;animate-&lt;/code&gt; instead of &lt;code&gt;animate__&lt;/code&gt;. Also, if you want, you can &lt;a href="https://tailwindcss.com/docs/animation#customizing"&gt;customize animations&lt;/a&gt; easily (add new or override the existing ones). Thank you!&lt;/p&gt;

</description>
      <category>animatecss</category>
      <category>tailwindcss</category>
      <category>animations</category>
      <category>configuration</category>
    </item>
  </channel>
</rss>
