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

Nir Benita
PLUS
Nir Benita
Courses Plus Student 3,905 Points

Isn't Zurb too large?

Hey guys! I'm starting my first project using Zurb and I was shocked to learn that it includes a whopping 1.72MB of uncompressed code, of course, compressing it will vastly decrease code size, but isn't it still wayyyyyy too big?

18 Answers

James Barnett
James Barnett
39,199 Points

Personally I think that Frameworks like Zurb foundation & Bootstrap add in too much to start with. You need to learn to walk before you run.


So learning the principles of:

  • fluid grids
  • flexible images
  • media queries
  • good typography

Then maybe add in a pre-processor such as less

Once you've got those down you will be better able to work on a large site that is already using a framework. However I'm a firm believer in not solving problems you don't have yet.


I'll leave you with my favorite quote on frameworks

Make sure every bit of code added to your project is there for a reason you can explain, not just because it is part of some standard toolkit or boilerplate.

Phil Rice
Phil Rice
5,536 Points

ive not used zurb but im guessing it doesnt really matter that much as you will only be using the files that you are referencing in your sites - they are arent going to be downloading large parts of the framework.

John Locke
John Locke
15,479 Points

You can always use just the parts you need, same as any framework.

James Barnett
James Barnett
39,199 Points

Nir Benita - You might want to check out this very interesting thread on using CSS Frameworks

Phil Rice
Phil Rice
5,536 Points

That sounds like very good advice. Even today I was using a style.css from the mikes tshirts php project from treehouse as a starting point and Ive found it caused me more bother having to search through the css than it would have been to make from scratch.

Think im going to take a framework like bootstrap and make a cut down version of it for beginning my projects - i.e with just the resets and things that I know I'll always want.

James Barnett
James Barnett
39,199 Points

Phil Rice - normalize.css and HTML5 boilerplate are good choices to include in every project. I'd suggest you cut most everything else, except for maybe table & form styling.

Phil Rice
Phil Rice
5,536 Points

normalize.css im familiar with and will check out HTML5 boilerplate. thanks James Barnett

John Locke
John Locke
15,479 Points

I echo James Barnett . I pretty much just use a reset and HTML5 Boilerplate, and I build out my own grids, media queries, adaptive-images.js, and that's it.

I am used to working with Bootstrap, etc through other projects, but there are too many stylesheets! Chris Coyier gave a talk this last year, that if you have more than 3 stylesheets on any page, it's too many.

Trying to find which stylesheets the CSS rules are coming from is easy to do, but why bother? Trying to override things becomes a pain. And don't even get me started on the gross overuse of ID tags.

Roll your own, and you'll become a much better front-end developer for the minimally extra effort. Use one stylesheet if you can. There's no reason not to put your reset and media queries on the same stylesheet as your main CSS, you save two HTTP requests. And never use @import if you can possibly avoid it either.

Phil Rice
Phil Rice
5,536 Points

James Barnett - this is slightly off topic but also slightly related maybe! On the site I was using the style.css from mikes tshirts today I have a weird formatting problem . The site is connecting to a MySql db using PHP and is pulling the records backs from a products table but no matter what I do the first record is formatted different to the others. Ive looked through the css to see if there are any first-child references or anything else it might be but I can see it .

Do you have any idea what might be cause this . It is CSS for sure because if I rename the css so it isnt used the formatting problem goes away - just cant spot what it is.

in fact looking at it - the first record ISNT being formatted and all others afterwards are.

James Barnett
James Barnett
39,199 Points

Phil Rice - Right click item in question select the inspect element feature to figure out where in your CSS that formatting come from.

Phil Rice
Phil Rice
5,536 Points

have tried that and I know where the formatting comes from for the ones that are formatted - i cant see why the first one is NOT formatted though . What might cause it to not format the first row or a table?

To answer your question, no, Foundation is not too large.

Nir Benita
PLUS
Nir Benita
Courses Plus Student 3,905 Points

Don't get me wrong! I'm a firm believer of knowing what every chunk of code is doing and how it's doing it, however, I believe learning to streamline your workflow is as every bit as important and acknowledging that some folks have done a better job than you in, let's say, building a responsive table, also matters a lot.

After messing with Foundation for a while, I now see that I could cut most of the code. The deeper I go, the better I understand it and the more I can cut.

I'm building the Backoffice for Templify and Foundation is a lot of fun to use!

Thanks guys, Nir

John Locke
John Locke
15,479 Points

Nir Benita Striking a balance between cutting time and writing efficient code is something that takes a lot of time to figure out. If you need a responsive table, just take the parts of the framework that deal with that specifically, and leave the rest. Simple.

James Barnett
James Barnett
39,199 Points

If you need a responsive table, just take the parts of the framework that deal with that specifically, and leave the rest.

Rather than using a framework if you want ideas about how to create a particular design element maybe check out some styleguides.

A few days ago there was a great blog post on design patterns and how they relate to frameworks

If you are looking for a good styleguide, here are some of my favorite:

I think people often use CSS Frameworks to try to create features they don't know enough CSS to create it by themselves.

So I think first you should learn to build the feature yourself, either by using:

  • a tutorial
  • a styleguide
  • trying to work out what each line of code for a particular feature in your choosen framework.
John Locke
John Locke
15,479 Points

+1 to what James Barnett said. Use Chrome Developer Tools or Firebug to play with the CSS, turn specific rules on and off, or change values, and you will get a great idea of what makes certain things react the way they do.

Knowing how layout works is vital.

Those links to the style guides are totally useful!

James Barnett
James Barnett
39,199 Points

Nir Benita - You might be interested in Brad Forest's Responsive Design Patterns

In particular the one on Responsive Table

Nir Benita
PLUS
Nir Benita
Courses Plus Student 3,905 Points

I REALLY appreciate the links :)

I wasn't really familiar with the concept of patterns in Front-End ( but rather, in design). I have no doubt this would a great thing to learn and I can't wait to get started!

Thanks all!