How to remove the excess CSS from bootstrap.min.css

I have the minify selected and it still does not clean it up well enough. Any suggestions?

You can’t unless you manually delete it post export

I really did not want to do that by hand, it can be a problem maker.

You will most likely still have to do this manually, but if you do it once you have the site completed and are sure you won’t need anything you remove (or at least copy what you remove to a backup file so you know what’s missing) then you can just put the new file on the server and don’t replace it with the exported one on future uploads. Not too difficult to handle. Keep a copy of the new file as well just in case you accidentally overwrite it lol. Keeps it simple this way without having to deal with export scripts and such.

Just open the CSS file and upload the other files when you upload and don’t upload the min file and you’ll be good to go.

Try https://purgecss.com/

Very easy to use, as long as you have node.js installed

In command line, install with:

npm i -g purgecss

then navigate to your export directory. Create a new folder called ‘purged’ (or anything you like)

then run the command below:

purgecss --css *.css **/*.css --content *.html *.js --output purged

The rewritten css files will then be stored in the ‘purged’ folder make sure you have the folder name after output

The *.js is to check to see if you have any styles dynamically generated in javascript so you could leave that out.

It should take bootstrap.min.css down to average 20kb, down from 159kb, depending on how much bootstrap you actually use.

1 Like

@richards

You can use purgecss online ,download the purged css file and add it as a theme to your design

1 Like

Thank you very much for sharing the details with the response.

1 Like