How to clean the Bootstrap stylesheet (CSS)?

Asked

Viewed 530 times

2

I own a site that uses Bootstrap, however, in this site there are many classes and id’s that I don’t use. This makes my site very heavy for nothing.

What can I do to delete all these useless classes and id’s?

Should I do it manually? (What am I thinking of doing)

Or is there a tool that does this work for me? (I don’t know if it exists)

1 answer

5

Are you sure that this is really why your site is heavy? I ask why I consider Bootstrap too light.


As for your question: Yes, is perfectly possible.

This is provided by some frameworks. In the specific case of Bootstrap go to http://getbootstrap.com/customize/ and select only what you want to use. There are other possible customizations as well.

I’ve heard of people deleting unused functions from jQuery source code, but I don’t recommend it because it might break some plugin. In this case there is no automated tool, you would have to do it manually anyway.


But I recommend you not to worry too much about it, because I find it very unlikely that Bootstrap/jQuery will be the performance bottleneck of your site. The most common error is abusing Javascript.

Instead look for tips like the ones below:

  • 1

    Another good tool for testing a site’s performance is the Pagespeed google.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.