Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Ryan Field
PLUS
Ryan Field
Courses Plus Student 21,242 Points

Bootstrap feature question

I have a question about using Bootstrap, if anyone can help.

So, I'm using bootstrap-sass on Compass (using Ruby on Windows) and I've got the hang of the basic workflow (watching and compiling), but I have a question that I can't seem to find the answer to.

On the official website, there's a section where you can pick and choose the features you need. When I'm working in Compass, however, is there a way to have your CSS file compiled by automatically including only the features you use on your page? If not, how do I go about selecting only the stuff I need? I'm a bit new to Compass and this specific workflow, so forgive me if I'm misunderstanding anything.

3 Answers

As far as I am aware the only way to trim what you are not using using bootstrap is by using the tool that you mentioned on their site when downloading the files. Another option is to delete any css selectors that you don't use. here is a blog that talks about shrinking your bootstrap file size. They do mention a tool you can use to find css selectors that are not used in your html. Take a look it may be what you are looking for. I personally have not tried bootstrap with sass so I may be wrong if their is another tool aside from the one mentioned in the blog.

I found another tool you can use but it uses grunt to delete any unused css selectors. Give it a try it may be just what you are looking for. It's another tool you may need to learn how to use but from what I read so far it's pretty simple and it can shrink your file size by a lot. Here is the guide on how to use grunt uncss plug-in

Ryan Field
Ryan Field
Courses Plus Student 21,242 Points

Wow, thanks for the info! I gave the grunt-uncss a try, but it seemed to remove some css that was necessary to my site. I thought that maybe since you were able to pick and choose which features you need from the Bootstrap download that there would be a similar feature (automated or otherwise) that you could do in the command line.

the bootstrap customizer has been deprecated due to bootstrap going to bootstrap3. they no longer maintain it and its not an option even if you go directly to the old webpage. (which sucks if you ask me, because it was a wonderful tool) I still do use the templates they offer on there as starting points when I"m doing some quick designs.

Ryan Field
Ryan Field
Courses Plus Student 21,242 Points

Are you sure? This page still lets you download a customized version of bootstrap, and that's the most recent version. Or are you saying that you used to be able to select elements when building a site with bootstrap via Compass/Ruby?

holy hell batman! where has this been hiding! I stand corrected and am quite excited thanks for pointing me in that direction . As to the compass/Ruby thing, i'm not an expert at Ruby but some of my coworkers had been complaining about that.