Purge css styles not in use?

In PG or VSC is there a way to purge css styles not in use?
All I can think of is to go thru and comment out each style and see if anything breaks.

Hi @kat,
The typical way this is done is to set up ‘PurgeCSS’ using Gulp or Webpack. I’m not sure what type of framework you are using at the moment. Normally I wouldn’t post this link, but I did write a free Pinegrow plugin that does a fairly good job at this, but likely shouldn’t be used for Tailwind CSS projects - the built-in JIT works better.
Cheers,
Bob

1 Like
  1. I’ve made it to the select files. Can’t open them.
    Screen Shot 2022-02-24 at 6.33.00 AM

  2. “Select folder of HTML files - note, non-HMTL files in the same folder will cause an error!” Does this means image files & anything other than html?


I’m not using frameworks for now. Too many style conflicts.

Hi @kat,
I’ll need more context for the top image. What did you click to bring up this file selection modal?
For the lower image:
In the top selection box you add all of the HTML files for the project. You can hold the shift or CMD to select multiples. If you choose to click on the folder tab and select a folder instead, it can only contain HTML files. Not images, not CSS, not JS - just .html files.
For the middle box, choose all of the CSS files for the project. Again, you can use shift/CMD for multiples.
For the bottom box you can choose an existing file or create one. This file will contain only the rules used on your pages.
Cheers,
Bob

1 Like

Selected html, then css files, then output css file, purged.css and clicked.
No purged.css materialized. What did I do wrong?

Hi @kat,
No file at all, or just not in your project? Did you refresh the project or look for the file in your file system?
Cheers,
Bob

1 Like

For an output file I choose purged.css; looked in the project folder before and after clicking “Purge It!” Nothing anywhere. Did a computer search

I tried first placing a new purged.css then selecting to “replace it” in the purge dialog box. Same result. Nothing happened.


Greyed out PurgeCSS
Screen Shot 2022-02-25 at 5.52.17 AM

Hi @kat,
I’m not sure what to tell you. It is working fine for me. Maybe a screenshot of the file dialog for when you select the purged.css file? Not sure what your second screenshot above is trying to show.
Bob

Clarification on what you’d like please. [quote=“RobM, post:8, topic:6313”]
a screenshot of the file dialog for when you select the purged.css file?
[/quote]
2nd screenshot: Unclear why there is a greyed out PurgeCSS above white Purge project CSS in the dropdown.
I tried again at 8:30am. Downloaded from Chrome instead of Firefox and put it on the desktop.
Same thing. It doesn’t save the purged.css file. You can see the purged.css that I had placed in the file is still dated 5:57am


Screen Shot 2022-02-25 at 8.34.10 AM

I’d really like to make this happen. The VSC extensions are complicated and more work to deal with.

Hi @kat,
The greyed out “Purge CSS” is just the menu section. Just like if you look in the Components menu you will see the “Libraries” or “Tools” sections.

For the file dialog, once you click on the “Choose File” button in the “Select Output File” section you will get a modal. Like this:


Cheers,
Bob

Restarted the imac. Then did everything again. The purged.css doesn’t update when saved/replaced or when I click purge it. It remains dated 5:57am today and Zero bytes. I downloaded Purge V3.1.0
Watched your tutorial, read the pdf & documentation.
Screen Shot 2022-02-25 at 9.54.44 AM
Screen Shot 2022-02-25 at 9.55.15 AM
Screen Shot 2022-02-25 at 9.55.24 AM


Screen Shot 2022-02-25 at 10.12.11 AM

Can you send me your project by wetransfer or similar?
Cheers,
Bob

1 Like

Just the project folder? And do you want the purge v3.1.0 folder?

Just the project folder. THere shouldn’t be any changes in the purge v3.1.0 folder and I have the original! :rofl:

1 Like

WeTransfer went to support@pinegrow.com. Thanks for this. I’m keeping my fingers crossed ; )

Not sure this has anything to do with the purge problem, but I keep removing the theme file and link in index.html in VSC. When I open index.html in PG, PG just adds theme files and link back in.

Also I removed some unused links with a VSC ext in bbq.css. Don’t like the ext.

Hi @kat,
It turns out that there was some errors in your bbq.css file that my plugin didn’t handle well. It threw an error in the DevTools, but never reported it to the user. The end file it generated is pretty small. I could upload it here, but it would also be pretty easy to fix the errors and rerun the plugin. There are two missing semicolons in the .container ruleset starting on line 51.

Pinegrow keeps adding the theme_files back in because you have the Design Panel activated. Inactivate the Design panel by clicking on the down caret at the bottom and selecting to deactivate.
Cheers,
Bob

1 Like

Can you upload your bbq.css? I’d like to see exactly what changed.

“It threw an error in the DevTools, but never reported it to the user” How did you find the error? Was the error " two missing semicolons in the .container ruleset starting on line 51"?

Thank you. This is great!

Hi @kat,
I’m pretty busy getting a tutorial ready so I’m not sure when I will get to this.
The error was generic - It just said that there was an error in the CSS files. I then had to scan each in VSC - the linter told me that there were missing semicolons.
Sorry,
Bob

1 Like

This is an opportunity to start over.
Can I add normalize without using the design panel? Maybe just add a new normalize html from PG?
Really looking forward to a new tutorial : )

Hi @kat,
A CSS “normalize” can either be downloaded or linked from a variety of sources. Here and here, for example. It is just another stylesheet, just like the ones where you add your styling to using Pinegrow.
Open the stylesheet manager from the File menu. If using the CDN link, click on the “Open Url” tab at the bottom, paste in the link, click add, and then make sure you attach that sheet to your page. If you are using a downloaded file, make sure it is in your project folder (maybe even in a CSS folder within that for neatness), click on the “Open File” tab, click on the folder and navigate to the stylesheet, click add, and then attach the sheet to your HTML page(s).
I’ll get you the purged file later. Looking closer I think the plugin is handling variables incorrectly.
Cheers,
Bob

1 Like