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

PurgeCSS Vite Plugin #2881

Open
endigo9740 opened this issue Oct 19, 2024 · 5 comments
Open

PurgeCSS Vite Plugin #2881

endigo9740 opened this issue Oct 19, 2024 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Milestone

Comments

@endigo9740
Copy link
Contributor

endigo9740 commented Oct 19, 2024

Link to the Page

Describe the Issue (screenshots encouraged!)

We need to verify this plugin is working with Skeleton v3. It can help dramatically decrease bundle sizes by purging unwanted CSS in the bundle. However there is some uncertainty on whether it will work, especially with the Vite 6 release recently

How to Test

For the initial test we'll ONLY test SvelteKit as we know it was working before in v2. Do the following:

  1. Create a new Skeleton v3 project for SvelteKit
  2. Run the npm run build command and view the size of the CSS bundle. It should be listed in the console during this process.
  3. Then, install the PurgeCSS plugin per the instructions on the docs linked above. I'll also share the readme below
  4. Build again, and compare the size of the CSS bundle. If it's working this should be reduced.

Handling the Results

There's two outcomes here:

  1. If the size doesn't go down, then we know it's not working and can aim to update the plugin asap
  2. If it is working, then we'll need to port that v2 doc over to the v3 docs under the Guides section

Follow Up Test

If it works in SvelteKit, ensure we've tested it in all Vite-based frameworks, including:

Note that Next.js uses Webpack/Turbopack, not Vite, and will not qualify for this test.

Reporting the Results

When tests are complete, ping me here (Chris) as well as @AdrianGonz97 (CokaKoala on Discord) to share the results. Adrian is the original author and can address any issues that might arise.

@endigo9740 endigo9740 added the documentation Improvements or additions to documentation label Oct 19, 2024
@endigo9740 endigo9740 added this to the v3.0 (Next) milestone Oct 19, 2024
@endigo9740 endigo9740 added the good first issue Good for newcomers label Nov 12, 2024
@phamduylong
Copy link
Contributor

@endigo9740 anything blocking this one? I can give this a go if it's just porting the same markdown over, into an mdx file

@endigo9740
Copy link
Contributor Author

@phamduylong yeah @AdrianGonz97 is the author of the plugin and was going to confirm it works for all supported meta-frameworks listed above. This may need additional effort now that Vite 6 has been released. So we'll need his thumbs up before we can progress on this.

@endigo9740
Copy link
Contributor Author

endigo9740 commented Jan 24, 2025

Confirmed working for SvelteKit + Skeleton v3 projects!

Image

@nullpointerexceptionkek
Copy link
Contributor

nullpointerexceptionkek commented Jan 24, 2025

I will update this comment along the way.

Updates Needed

  • The plugin's peer dependencies for Tailwind should be updated to 4.0.0.
  • The command npx tailwindcss init -p in the documentation is not supported for Tailwind version 4.

This will work:

npx [email protected] init -p

Additional Note

It would be helpful to add documentation regarding TailwindCSS 3.3.0 (and early 3.4 versions), which does not support import.meta.url.


Framework Compatibility

  • SvelteKit:
  • Svelte + Vite:
    assets/index-Dg-FftHS.css               72.98 kB  ->  34.28 kB
    
  • React + Vite:
    assets/index-BrGkwYAO.css               66.40 kB  ->  32.04 kB
    
  • Astro:
    _astro/ec.rh18c.css               18.25 kB  ->  14.87 kB
    

@endigo9740
Copy link
Contributor Author

@AdrianGonz97 just pinging you here to make sure you're aware. This is great news though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants