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

Nuxt3 compatibility #116

Closed
nelsonxx1 opened this issue Mar 5, 2022 · 15 comments · Fixed by #125
Closed

Nuxt3 compatibility #116

nelsonxx1 opened this issue Mar 5, 2022 · 15 comments · Fixed by #125
Assignees

Comments

@nelsonxx1
Copy link

is there any way to do the same in nuxt3 with vite?

@bootsmann1995
Copy link

@nelsonxx1 did you manage to do this in nuxt3?

@kissu
Copy link

kissu commented Aug 1, 2022

If you're using Nuxt3, then you probably don't need to purge Tailwind itself.
Since it is using JIT for quite some time already hence, not creating un-used classes by default.

https://tailwindcss.com/docs/upgrade-guide#configure-content-sources

@gokaybiz
Copy link

If you're using Nuxt3, then you probably don't need to purge Tailwind itself. Since it is using JIT for quite some time already hence, not creating un-used classes by default.

https://tailwindcss.com/docs/upgrade-guide#configure-content-sources

What should we do if we use bootstrap or something else?

@kissu
Copy link

kissu commented Aug 22, 2022

@gokaybiz it's unrelated to Tailwind, so I guess: nothing.
Otherwise, maybe whitelisting it if you have any issues but you cannot really reduce the size of Bootstrap thanks to Tailwind's purge. ❌

@dosstx
Copy link

dosstx commented Aug 22, 2022

What should we do if we use bootstrap or something else?

@gokaybiz One thing you could do is just comment out the components from your SASS file you don't use in your code.

See more info: https://getbootstrap.com/docs/5.2/customize/optimize/#lean-sass-imports

@kissu
Copy link

kissu commented Aug 22, 2022

Or just don't use bootstrap in the first place if you care about performance and long term style haha. 😂

@dosstx
Copy link

dosstx commented Aug 22, 2022

Or just don't use bootstrap in the first place if you care about performance and long term style haha. 😂

I prefer Bootstrap (version 5) over TW:) Nice mix of ready-made components and utilities.

@kissu
Copy link

kissu commented Aug 22, 2022

You do you. 😉

@gkkirilov
Copy link

This will be a great addition

@kstraszewski
Copy link

Hi I would like to use purgeCSS on Vuetify 3 to purge some CSS, is there any way to do it?

@kissu
Copy link

kissu commented Aug 24, 2022

@kstraszewski give a try to that one: FullHuman/purgecss#67 (comment)

@manniL manniL self-assigned this Aug 24, 2022
@travisricks
Copy link

Just confirming, but currently this plugin does not work with Nuxt 3. Is that correct?

@bootsmann1995
Copy link

@travisricks

You can implement it through potscss as a plugin like this:

this is diretcly in the nuxt.config

postcss: {
		plugins: {
			"@fullhuman/postcss-purgecss": {
				mode: "postcss",
				enabled: true,
				content: [
					resolve(__dirname, "components/**/*.vue"),
				],
				styleExtensions: [".css"],
				whitelist: [
					"body",
					"html",
					"nuxt-progress",
				],
				whitelistPatterns: [
				],
				whitelistPatternsChildren: [],
				extractors: [
					{
						extractor: (content) => content.match(/[A-z0-9-:\\/]+/g) || [],
						extensions: ["html", "vue", "js", "ts", "mjs"],
					},
				],
			},
		},
	},

@AlexBa
Copy link

AlexBa commented Sep 10, 2022

@bootsmann1995 Thank you for your code! I have used your template and extended it a little bit for Nuxt 3. Works in my case with Bootstrap 5 and Font Awesome 5:

  postcss: {
    plugins: {
      '@fullhuman/postcss-purgecss':
        process.env.NODE_ENV === 'production' || process.env.ENABLE_PURGE_CSS === 'true'
          ? {
              mode: 'postcss',
              enabled: false,
              content: [
                resolve(__dirname, 'components/**/*.vue'),
                resolve(__dirname, 'pages/**/*.vue'),
                resolve(__dirname, 'layout/**/*.vue'),
              ],
              safelist: {
                standard: ['html', 'body', 'a', 'svg-inline--fa']
              },
              keyframes: true,
              variables: true,
            }
          : false,
    },
  },

@manniL
Copy link
Member

manniL commented Sep 10, 2022

Just confirming, but currently this plugin does not work with Nuxt 3. Is that correct?

Yes, but I'll release a major version for Nuxt3 soon ☺️

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

Successfully merging a pull request may close this issue.

10 participants