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

Can't get WindiCSS working #36

Closed
CanRau opened this issue Apr 12, 2021 · 10 comments
Closed

Can't get WindiCSS working #36

CanRau opened this issue Apr 12, 2021 · 10 comments

Comments

@CanRau
Copy link
Contributor

CanRau commented Apr 12, 2021

Hey there, your plugin looks very promising, thanks a lot for your efforts 🙏
I'm completely new to vite, worked only with Gatsby and Next so far with Tailwind.

I tried WindiCSS in a "raw" Vite scaffold (using the CLI) then installing Windi according to the vite-plugin-windicss docs which worked just as expected.

Trying to do replicate this in my beforehand scaffolded vite-plugin-ssr project using the CLI failed to import the CSS styles (only the custom properties --tw-* are included in the final build .css).

I've put the import "virtual:windi.css"; "everywhere" starting in _default.page.client.tsx than added to index.page.tsx without any changes.

Uh I'm also using useClientRouter in _default.page.client.tsx.

What am I missing or doing wrong?

@brillout
Copy link
Member

At first glance, I wouldn't know why it doesn't work.

  • @import 'tailwindcss/base'; does work as expected, correct?
  • You did include WindiCSS() in your plugin list in vite.config.js, yes?

@CanRau
Copy link
Contributor Author

CanRau commented Apr 12, 2021

Haven't tried any direct Tailwind stuff yet 🤔 How should I go about it?

Yes, WindiCSS() is in my vite.config.js, followed all setup steps which worked correctly as expected in plain vite-react-ts 🤷‍♂️

@brillout
Copy link
Member

Let me have a look

@brillout
Copy link
Member

@CanRau
Copy link
Contributor Author

CanRau commented Apr 12, 2021

My fault I should have read the docs better 😅

It defaults to only working with files in /src had to include /pages to options as described here https://windicss.org/guide/vite.html#scanning

(already provided a PR to fix the typo in the example windcss/helpers, misses the second i)

@CanRau CanRau closed this as completed Apr 12, 2021
@brillout
Copy link
Member

👍 Let me know if you have any ohter question

@CanRau
Copy link
Contributor Author

CanRau commented Apr 12, 2021

Working example: https://github.com/brillout/vite-plugin-ssr-vite-plugin-windicss

Just out of curiosity, I couldn't find any mention of actual Tailwind classNames, have you confirmed they're working?
As according to my trials and the Windi docs on scanning it shouldn't work ^^

@brillout
Copy link
Member

I was wondering the same ^^; I just saw the Tailwind CSS included so I was assumings that things work. (I never used Tailwind CSS.)

had to include /pages to options

If this necessary then we should def add a little guide to vite-plugin-ssr's README. A PR would be warmly welcome :-).

CanRau added a commit to CanRau/vite-plugin-ssr that referenced this issue Apr 12, 2021
As requested in vikejs#36 (comment)

Let me know if that works for you.

Could provide a basic example soonish, but don't count on that as I'm a little distracted from offline things at the moment 🤪
brillout pushed a commit that referenced this issue Apr 12, 2021
As requested in #36 (comment)

Let me know if that works for you.

Could provide a basic example soonish, but don't count on that as I'm a little distracted from offline things at the moment 🤪
@konsumer
Copy link

konsumer commented Sep 6, 2022

@brillout your demo didn't use any tailwind util classes. It doesn't error for me, but it doesn't apply any windicss styles either.

If I import 'virtual:windi.css' in PageLayout.jsx, it should work, but it doesn't:

Screen Shot 2022-09-05 at 10 20 17 PM

Do I need to do something else?

@brillout
Copy link
Member

brillout commented Sep 6, 2022

It does: https://github.com/brillout/vite-plugin-ssr_windi-css/blob/2310ad8ea3889c0c9fe5f73d902be49b25315273/pages/index/index.page.jsx#L9.

Do I need to do something else?

Yes, see the warning at https://vite-plugin-ssr.com/windi-css.

Please read the docs before asking for help. See https://brillout.github.io/rules/.

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

3 participants