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

CSS

Should I use Twitter bootstrap or any other framework to make a heavy 'dynamic' website (like Treehouse, duolingo)?

-Usage of CSS frameworks for dynamic websites -Is it manegable and maintainable? -What are the pros and cons?

Thanks in advance

6 Answers

My pleasure! As in all things, it's a balancing act between the design or interaction you want to achieve, and the cost in either bandwidth, CPU or GPU.

If you're building a web app or dynamic site, don't forget that your own bandwidth is a cost center, and thus the fewer HTTP requests and the smaller the payloads you need to deliver, the smaller your Internet bill will be (and on something like Amazon Web Services, it adds up). Typically, mobile users have an additional 8 second delay for every HTTP roundtrip, so the fewer of those you need to make, the better.

Frameworks can help with rapid prototyping and development, and since they're tested in the real world you know they're reliable. Foundation is a very good one, and it uses the more widely adopted Sass instead of LESS, for instance. But for your own needs you may want to adopt "just enough" CSS/JS, depending on what it is you want to build. You'll have to judge for yourself.

Even with a framework, there's usually the issue of compression/minification - you will want readable "regular" files for coding, but you'll want to serve minified files (with all the spaces, line breaks, tabs and comments removed).

There are some techniques that move responsiveness to the server, for instance, using detection scripts to serve up the appropriate CSS; this may work if you have a massive site with a lot of traffic, but it may involve too much server overhead for smaller sites/apps.

Where performance is critical, and particularly for mobile, many developers are using techniques such as inline stylesheets (to get the core, basic styles delivered in the same request as the HTML), and using base64-encoded data URIs to embed fonts, images and image sprites directly into the HTML as well. It sounds old-fashioned to do it that way, vs. proper separate HTML/CSS/JS, and it affects code maintainability as you have file types mixed into different places, but if there is a speed advantage, it's something to look at.

As to how it performs client-side, responsiveness is a big part of how sites and apps are perceived. If the end-user is left with interminable spinning "loading" cursors, they will rate the experience poorly, so that's why the connection between client and server needs to be managed carefully, and CSS styling weighed against "wait time." Do you really need that fancy font? Your site may load quickly, but if your JS/AJAX takes another 10 seconds to process, how long until your user can actually interact with the site? That's why it's a good idea to defer some things until invoked by a user interaction; lazy-loading, etc.

The server can't be processing things dynamically for every single request, or it'll eat up all your CPU time and plus it'll be slow for the user; the reality is most user data isn't always changing and thus doesn't need to be re-rendered every time, and that's why caches, static files etc are key - again, that's more of a devops thing, but ultimately it all becomes part of the user experience. Good luck!

Given that Bootstrap was used to build one of the most heavily trafficked websites in the world, I'd say it's OK to use for complex apps. The performance of a web app depends on so many other things, the choice of a front-end framework for layout, grids and buttons is not likely to be a major factor.

Still, there are ways to optimize any off-the-shelf framework + your front-end elements to make them more performance-friendly; some of it goes more towards devops than front-end design. Caching, CDNs, minification, gzipping, using svg, proper image compression, and creating subsets of large .js libraries will speed delivery to the end-user.

Presuming your front-end isn't being a resource hog (tons of JS, gratuitous animations, or CSS that's triggering a lot of repaints / causing janky scrolling, etc) I wouldn't worry about it that much.

Thanks for your detailed answer. It really helped me.

Thanks for your detailed answer. It really helped me.

Wow, your answer covered nearly everything I was wondering. Thank you very much for it again. I am new and have been learning front-end development about 3 months. I am gonna speed up this summer. I've heard that all these seperate documents that we create can be collected together in output as one single document by using CSS preprocessors. In that way, we can get rid of seperate HTTP requests. So, maybe my next goal should be learning Sass. Many thanks

Recently I was asking myself this exact same question. In the past I always leaned towards foundation, maybe it was because I enjoyed sass over less or maybe it was that I just liked the little space dude on the homescreen...who really knows. Anyway, recently I revisited this question and after looking around I found this really awesome comparison on Vermilion http://responsive.vermilion.com/compare.php This gives you a full on breakdown of every single aspect of the 2 frameworks. What I would suggest doing is making a list of things that are important to you and then deciding which framework you feels handles things better!