Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Removing unused CSS code from Bootstrap 3

Posted on 2014-12-18
5
Medium Priority
?
477 Views
Last Modified: 2014-12-18
Hi, I am fairly new to Bootstrap. Here's a site I put up: diabeticmealprograms.com.

By going to Chrome development tools, I can see that there was one whole CSS file I wasn't using, so I took away the link to that file on all the pages.

But for other files, like bootstrap.css: 93% is not used by the current page.
I'd love to take that all away, and they list it, but I'm not sure how to go about removing it, without looking for each bit of CSS, and deleting it on the CSS page. That would take forever.

So, two questions:

1. Is it worthwhile deleting all the unused CSS?
2. Is there an efficient and accurate way of doing it?

Thanks!
0
Comment
Question by:mel200
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 58

Assisted Solution

by:Gary
Gary earned 1000 total points
ID: 40508287
If you are using a CDN for the Bootstrap files (sometimes better) then there is no point
Otherwise install Dust-Me selector in FF
Create an XML sitemap of all pages in site and run Dust-Me with the sitemap, it will create a new css file with all redundant css removed.
0
 

Author Comment

by:mel200
ID: 40508316
Nice, thanks! I'll try that right now.
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1000 total points
ID: 40508317
I use the CSS-Usage 0.3.3 extension in Firefox to check for unused CSS and eliminate it.  But if it is in external files that are used by many pages, then you usually need to leave it alone.  The only reason I clean up CSS in my customers pages is to make it easier to see what's going on.  Otherwise, there is almost never any impact on page load or operation unless they have done some really dumb.
https://addons.mozilla.org/en-US/firefox/addon/css-usage/
0
 

Author Comment

by:mel200
ID: 40508330
Ok, thanks, Dave, I'll keep that in mind as well. It will take me a couple of tries to work with dustme, good tool.
0
 

Author Closing Comment

by:mel200
ID: 40508332
Thanks to both of you!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question