CSS 'frameworks' are missing the point (2008)
stackoverflow.com
stackoverflow.com
What I do is have bootstrap.css vanilla loaded, then I load a bootstrap_overrides.css.scss where I override styles/colors/looknfeel. Make bootstrap my own, you know?
[1] - http://smitecamp.com/
You can even customize it on their server if you aren't comfortable doing it yourself: http://getbootstrap.com/customize/
At least the SASS-port of Bootstrap declares it's variables as defaults - meaning they would not be set if they were set earlier (in your configuration). This makes upgrading the gem (or plain source files) rather simple. But sure, you might have to check if anything was renamed or added.
But with overriding you do not only create redundant, unnecessary styles (and bytes), but if you now upgrade your bootstrap files as you suggest, you also have to change your overrides - which depending on the amount of changes you did will be significantly more work (and 'mental gymnastics') - if changes were introduced.
So you gain very little (less setup effort) but lose quite a lot.
I don't agree. I've launched several semi-successful sites where I've used Bootstrap solely because of the looks. Why exactly is that wrong?
Saves time, overwriting a bunch of code and I can use it with whatever I want - Less, SASS, MYTH, etc.
Plus the code is about 200% cleaner.
[1] https://github.com/twbs/bootstrap/tree/master/less
[2] https://github.com/twbs/bootstrap-sass/tree/master/vendor/as...
I agree with the points about it being just a large set of declarations, there aren't a lot of good ways to lazy load CSS (that I know of) so in some cases you're pushing a lot of bytes that you don't need to and creating dead weight.
Also the presentation in markup point is one I have been saying for years. We hear about the death of tables and why it needed to happen and go back and do similar stuff. But without extensive use of something like jQuery you have to do it.
I think these frameworks are awesome for people like me. I'm a backend coder, and I am not that good at CSS. I love being able to whip out a layout and interfaces in a fraction of the time, so I can focus on what I do best. It's not that I'm afraid of CSS (I can write it) it's just that I'm afraid of wasting time.
This is the primary reason these frameworks have flourished IMO. Useless? Not even close.
Not just with the precompilers - LESS/SASS/Stylus - but with the overwhelming amount of web apps being developed with modern CSS frameworks like Bootstrap and Zurb Foundation.
Bloat of a hundred framework rules? - None of these will be included if you use mixins and selectively mixin the stuff you need.
Unsemantic grid sizes - Personally, I think this is something where utility trumps perceived "cleanness" of semantic HTML, but if you want to you can use mixins for this as well to hide the grid stuff in your CSS.
Not responsive - SASS and LESS don't do anything specific here, but this is definitely an outdated comment - Bootstrap's responsive grid is probably better than anything you could code yourself without devoting a lot of effort to it.
Even within the strict scope of CSS this post shows it's age. The phrase above in particular reaks of being written in a time before philosophies such as OOCSS. Additionally, popular frameworks are no longer tied as tightly to fixed-pixel values.
If somebody were vehemently arguing these sorts of points today, I would be concerned that I was dealing with the type of developer who resists change or is opposed to exploring and understanding the approaches of others.
<div class="container">
<nav class="row nav-header">
<div class="col-sm-2 my-logo">
<!-- your stuff -->
</div>
</div>
</div>
that you could perhaps use mixins to replace some of the elements with (you could mix-in "row" to "nav-header", and "col-sm-2" to "my-logo"), but regardless, you still need three DOM nodes, and trying to fit those into a purely semantic separate-structure-from-presentation box can get extremely tiresome.I definitely don't like this. That said, the speed and flexibility of frameworks like Foundation/Bootstrap are just so vital for my front-end speed that I can't imagine giving these things up.
One other advantage is that, if you're working with other front-end developers who have used your same framework, there is a lot of knowledge sharing that happens automatically (knowing when and where to use containers, for example, can save a lot of headache when two devs are working on the same front-end layout).
At a certain point we do actually have to produce a site or an app. If I mange to get the product released while keeping the code clean, organized and consistent then I feel like I'm doing OK.
Your CSS could easily be shortened to:
.body {
@extend .container;
}
.nav-header {
@extend .row;
}
.my-logo {
@extend .col-sm-2;
}
And your markup could be much cleaner: <body>
<nav class="nav-header">
<div class="my-logo">
<!-- your stuff -->
</div>
</nav>
</body>Still, your final output produces three levels of DOM, which was exactly what my point was. No matter how much you try to export your grid code into your CSS (and you should try!), you will always run into situations where you need that <div class="row"> and there will be no way to semantically handle that.
Furthermore, there are some limitations even when combining semantic elements that cause issues. For instance, I often write this code:
<div class="row well">
To find that the exact margin/padding values I want for my well interfere with the default padding/margin values provided by row defaults. In those cases, I almost always have to add an additional DOM level and separate my classes to achieve my effect.I find frameworks more useful for rapid prototyping. I can make a cheap wireframe with some bootstrap styles, and quickly move things around until I get the layout I like. then I'll build the final draft from scratch.
So what are we doing?
It does not matter if the framework is mixed in by SASS or LESS, because from that point of view you could argue that Javascript frameworks are not required, because they could be mixed in as well.