Skip to content

Conversation

@MUmarShahbaz
Copy link
Contributor

Fixes #3266

Purpose

Issue: PurgeCSS was not working with purgecss.config.js, only with inline config

Solution: Created a Ruby Gem to run PurgeCSS using Configuration defined inside _config.yml.

Now, all assets optimization configs (minifier, terser, purgecss) are together allowing ease of use.

Example of use

Before

Opera Snapshot_2025-08-16_095904_github com

After

Opera Snapshot_2025-08-16_100042_github com

New Logs - Helps in debugging

Opera Snapshot_2025-08-16_095717_github com

@netlify
Copy link

netlify bot commented Aug 16, 2025

Deploy Preview for relaxed-lollipop-b6bc17 failed. Why did it fail? →

Name Link
🔨 Latest commit e823d9a
🔍 Latest deploy log https://app.netlify.com/projects/relaxed-lollipop-b6bc17/deploys/68a01365bb80db00073bbe31

@MUmarShahbaz
Copy link
Contributor Author

@george-gca here's another one!

@MUmarShahbaz
Copy link
Contributor Author

Note: The Netlify Errors occur because you are installing purgecss post-build to run with purgecss.config.js. With this gem you will need it to be installed pre-build.

Size Stats:

Stat Before After
CSS Directory Size 3.80 MB 2.81 MB
CSS Directory URL here here
Workflow run - here

@george-gca
Copy link
Collaborator

Will definitely took a look at this.

@stale
Copy link

stale bot commented Oct 26, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 26, 2025
@stale stale bot closed this Nov 5, 2025
@george-gca george-gca reopened this Nov 17, 2025
@george-gca
Copy link
Collaborator

@MUmarShahbaz sorry for the (VERY LONG) delay on checking this. Question: we have in our purge css config this line:

skippedContentGlobs: ["_site/assets/**/*.html"]

This is used to avoid purging inline css, if I am not wrong, for htmls generated by jupyter notebooks. How this is being handled in your case? Does it displays correctly the notebook from the sample, both light and dark modes?

@MUmarShahbaz
Copy link
Contributor Author

@george-gca that's what I thought earlier too. For some reason, it has just a ghost presence. It doesn't do anything. You can see from the huge difference in size when running my plugin as compared to the current setup.

Right now, I'm trying to mimic the customization options through manual logic in ruby and there are some kinks, I admit, but overall it's working.

I spent hours, using your repo for reference, to add purgecss to mine. After failing many times, it turned out that your's isn't working either.

@MUmarShahbaz
Copy link
Contributor Author

As for the skipped content blobs, it basically never touches them. Underneath, it uses logic to manually single out and purge each file one at a time. You can see them in the logs as it goes them all.

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 this pull request may close these issues.

PurgeCSS not working

2 participants