4

so close yet so far :(

anyone got any tips for how to remove unused css? is there any tool that can remove classes from bootstrap i don't use?

Comments
  • 0
    Unless you have 1 page and 1 view, then that can be a false positive.
    Dynamic content and multiple pages are not scanned, otherwise you would need to have a single css file per view to get that to 100 on all views, and that's not maintainable.
  • 0
    @C0D4 each page on the website uses the same bootstrap 4 css file and the same custom css file i wrote myself (in the image it's the index.css file is used on every page in my site)

    @2Large i am, but there's still a lot of unnecessary css along with it (it said i use 0.3kb of the about 20kb file somewhere else)
  • 1
    Well, thats an interesting question and it made me wonder a bit. There must be tool for that. I did some research and found this:

    https://stackoverflow.com/q/4361007
  • 1
    Angular compiles it out automatically.
  • 2
  • 2
    Bootstrap is stupid shit born out of gross misunderstanding how HTML/CSS were supposed to work. The CSS is a bloated shitfest, and apparently even split out over several files.

    Ditch that piece of shit and reduce your CSS by a factor of 10 easily.
  • 1
    Here's how it looks with no bloated crap and custom CSS - and also without moronic nonsense that Pagespeed Insights used to "advise", like inlining CSS into the markup.
  • 0
    @pxeger Not using it myself, but can imagine it would be not a good idea to use it for Dev builds, only prod.
  • 0
    I know but go on Stackoverflow not here :(
  • 3
  • 2
    PurgeCSS
  • 0
    Their is a tool to generate customized bootstrap with only the components you need, then you can just embed that into your page, My suggestion is to use Bootstrap only if you completely utilize it, using it just for 1-2 components is waste of resources, you can find code for those components from codepen.
Add Comment