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

Pug classes doesn't work in Nuxt3 #144

Open
xxSkyy opened this issue Dec 11, 2021 · 3 comments
Open

Pug classes doesn't work in Nuxt3 #144

xxSkyy opened this issue Dec 11, 2021 · 3 comments

Comments

@xxSkyy
Copy link

xxSkyy commented Dec 11, 2021

I don't know if it's bug or it's not implemented but in Nuxt3 pug templates classes doesn't work in any case

.bg-red-500.p-2 Text

or

div(class="bg-red-500 p-2") Text

doesn't work, only html

for repro just take any actual nuxt3 + windicss sandbox add pug and pug-plain-loader dependencies and convert template to pug. it won't load any class

Edit:

div(class="bg-red-500 p-2") Text

seems to work, it didn't few days ago or I din't notice it works 🤷🏼‍♂️

@jbmolle
Copy link

jbmolle commented Dec 16, 2021

I've tested it and it seems that the class syntax works but Pug syntax doesn't.
p(class="text-red-600") My Text will show correctly a red text.
But p.text-red-600 My Text doesn't show the red text

@xxSkyy
Copy link
Author

xxSkyy commented Dec 17, 2021

I've tested it and it seems that the class syntax works but Pug syntax doesn't. p(class="text-red-600") My Text will show correctly a red text. But p.text-red-600 My Text doesn't show the red text

You're right, I've updated issue

@jbmolle
Copy link

jbmolle commented Dec 17, 2021

The problem comes from require('pug') in getDefaultExtractors function.
One solution is to add the following to your nuxt.config.ts
import { PugExtractor } from 'vite-plugin-windicss
And then

windicss: {
  config: {
    extract: {
      extractors: [{
        extractor: PugExtractor,
        extensions: ['vue', 'pug']
      }]
    }
  }
}

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

2 participants