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

Nuxt UI & PurgeCSS #2850

Open
AndreiMaelstrom opened this issue Dec 6, 2024 · 2 comments
Open

Nuxt UI & PurgeCSS #2850

AndreiMaelstrom opened this issue Dec 6, 2024 · 2 comments
Labels
question Further information is requested

Comments

@AndreiMaelstrom
Copy link

AndreiMaelstrom commented Dec 6, 2024

For what version of Nuxt UI are you asking this question?

v2.x

Description

Hello,

I've been trying to make PurgeCSS work properly with Nuxt UI and the deeper I get the more cumbersome of a process it becomes.

It seems that even though I provided the paths towards the NuxtUI components to PurgeCSS, it still removes CSS that should be used by the specified components, as well as colors which should be available out of the box (i.e yellow). I've even tried to safelist different classes, but again, the more I dig through it the more classes I eventually have to add - so I will be ending up with a never ending list of classes.

Are there any official guidelines on how PurgeCSS should be configured so that it works correctly for the NuxtUI components/colors?

Current config:

defineNuxtConfig({
...
 purgecss: {
   safelist: [... big list ...],
   paths: [
      './components/**/*.vue',
      './layouts/**/*.vue',
      './pages/**/*.vue',
      './plugins/**/*.js',
      './nuxt.config.ts',
      './app.config.ts',
      './node_modules/@nuxt/ui/dist/runtime/components/**/*.vue',
      './node_modules/@nuxt/ui/dist/runtime/ui.config/**/*.js',
      './node_modules/@nuxt/ui/dist/runtime/utils/*.js',
    ],
    content: [
      './components/**/*.vue',
      './layouts/**/*.vue',
      './pages/**/*.vue',
      './plugins/**/*.js',
      './nuxt.config.ts',
      './app.config.ts',
      './node_modules/@nuxt/ui/dist/runtime/components/**/*.vue',
      './node_modules/@nuxt/ui/dist/runtime/ui.config/**/*.js',
      './node_modules/@nuxt/ui/dist/runtime/utils/*.js',
    ],
}
});

Thanks in advance :-)

@AndreiMaelstrom AndreiMaelstrom added the question Further information is requested label Dec 6, 2024
@benjamincanac
Copy link
Member

Sorry I have no knowledge of purgecss to help you but I'm linking #877 as it was discussed there if I remember correctly.

@AndreiMaelstrom
Copy link
Author

Thanks for getting back Benjamin!

I went through the linked issue, and it seems more like a general discussion with different "trials" on how to reduce the bundle/css size of NuxtUI. Is there an "official" standpoint or documentation on how to approach this?

Thanks!

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

No branches or pull requests

2 participants