Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite support? #50

Open
msmosavar opened this issue Feb 28, 2022 · 10 comments
Open

Vite support? #50

msmosavar opened this issue Feb 28, 2022 · 10 comments

Comments

@msmosavar
Copy link

msmosavar commented Feb 28, 2022

As vuejs 3 uses vite as default bundler, is there any way to use this package with it?

@lord007tn
Copy link

it doesn't matter which bundler you use
because this plugin is built on top of tailwind so you just need to configure your tailwind with Vite : link here
then install the plugin as a dev dependency and call it inside the tailwind.config.js in the plugins section

@msmosavar
Copy link
Author

msmosavar commented Mar 10, 2022

@lord007tn To reproduce the problem, i've just started a new project using vuejs 3 and added tailwindcss.
Everything works correctly and tailwind classes take effect.
Then i've installed tailwindcss-rtl using npm install tailwindcss-rtl --save-dev and there is my tailwind.config.js:

module.exports = {
  content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"],
  theme: {
    extend: {},
  },
  plugins: [import("tailwindcss-rtl")],
};

App.vue:

<template>
  <div class="flex justify-center items-center h-screen">
    <div class="w-1/2 bg-blue-500 p-10">
      <p class="text-2xl text-white ps-10 ms-10">
        Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem, vero.
        Voluptatum, non minus! Ea ullam accusamus nobis iste eos, voluptates
        fugiat soluta architecto. Deleniti unde, maiores vel possimus quos et.
      </p>
    </div>
  </div>
</template>

But as you can see in the image below, none of tailwindcss-rtl classes (e.g. ps-10, ms-10) are taking effect.
tailwindcss-rtl-vite.png

Also in devtools these classes are not shown:
devtools.png

@itsikhar
Copy link

@lord007tn Same issue as you describe in my project, any update ? found any solution ?

@crswll
Copy link

crswll commented Aug 26, 2022

You need to use require not import like the sample code provided.

@itsikhar
Copy link

@crswll Thanks for your reply, already try it but Vite not support require thats why we try using import but tailwindcss.config.js not support Import.

@crswll
Copy link

crswll commented Aug 26, 2022

I just set up a fresh project with it and it's working.
Screen Shot 2022-08-26 at 3 00 58 PM

@itsikhar
Copy link

@crswll And dir="rtl" attribute added to body ?
all other rtl attribute added to html ?

@crswll
Copy link

crswll commented Aug 26, 2022

The plugin wouldn't do that. You'd need to do that yourself.

@itsikhar
Copy link

Oh, ok I will try it and let you update.

@itsikhar
Copy link

itsikhar commented Aug 26, 2022

@crswll Ok, my LTR/RTL variable did not update correctly, thanks for this tip :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants