Vue Transitions Css Save

A lightweight CSS library for adding transitions to Vue 2 components :sparkles: :green_heart:

Project README

vue-transitions-css

All Contributors

A lightweight CSS library for for adding transitions to Vue components :star:

Demo | Contribution | Changelog

USAGE

Installation via NPM:

npm install vue-transitions-css

In the main.js file:

...

import 'vue-transitions-css';

...

This imports the minified css distribution file globally, available for use anywhere in the project.

In any .vue file:

  <transition name="fade">
    <Content v-if="show" />
  </transition>

Be sure to set the mode of the transition so it doesn't appear janky:

  <transition name="fade" mode="out-in">
    <Content v-if="show" />
  </transition>

purgeCSS fix

In some cases, the animations would work during development, but not when you build and deploy to production. This issue is most likely with purgeCSS or any other optimization tool. especially if you use Nuxt.js and TailwindCSS module.

To fix the issue: In your purgeCSS config, you have to whitelist every animation class you use in your app. If you use the fade-x animation for example, add a regexe pattern for purgeCSS to ignore any css class that will include fade-x in it's name.

in nuxt.config.js:

export default {
   purgeCSS: {
    whitelistPatterns: [/fade-x/]
  }
}

Contributors ✨

Thanks goes to these wonderful people (emoji key):


jonathan

💻 🚧

Simeon Udoh

💻 🎨

This project follows the all-contributors specification. Contributions of any kind welcome!

Open Source Agenda is not affiliated with "Vue Transitions Css" Project. README Source: Edmund1645/vue-transitions-css
Stars
43
Open Issues
37
Last Commit
1 year ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating