Hacker News new | ask | show | jobs
by jonmc12 5348 days ago
Recently I walked into project that used Twitter bootstrap for the initial CSS. A prototype was built, relying on the bootstrap CSS, and from that point on it has been hassle to work with the CSS.

I'm really not sure I understand the strategy of dumping so many styles into the global name space. Basically, all of us have been working around the styling as we implement features.. a major refactor is in order and we will likely be ditching bootstrap.

Just a warning if you plan to build beyond the styles provided by bootstrap, it is not straightforward. Really, the entire set of styles should be contained within its own namespace or some other meaningful semantic convention.

Am I missing something? What is intended after 'boot'? am I really supposed to replace these global styles manually?

5 comments

I suppose this is where you rely on the cascading thing - place a @import at the bottom of your bootstrap for your overrides.

Using a framework favors convention over configuration for the benefit of speed.

I especially like it because the team has a central set of documentation for the UI to use - that means if we override a style, if they followed the convention, everything works out better.

I do agree using a namespace would help though.

As a counterexample, I just built a site with Bootstrap, and I was very happy with the experience. It's the first site I've ever made that I think looks pretty good.

I worked around the styles I didn't want in two different ways. One, I built my own version of the css that excluded all the form styles (non-native controls are bad). This involved installing some packages that I didn't really understand but didn't need to. It took maybe five minutes start to finish. The second was simply overriding the CSS I didn't want. This is absolutely no different than what you do with any other website, where you're overriding the browser's default styles instead of Bootstrap's.

"This is absolutely no different than what you do with any other website, where you're overriding the browser's default styles instead of Bootstrap's"

Its different. There are all kinds of properties I don't want to have to override. This gives me the option of deleting code from bootstrap css or having duplicate css code in my project, every page load, and every rendering of the dom.

A prototype is fine, but once I'm working with a graphic designer, its mostly undoing vs overriding. Would be so much more bootstrap-able if the styles were constrained to classes.

I agree. The problem I'm facing now is that I customized a lot of the CSS styles directly, but with the new ongoing updates, it's not going to be easy to merge them through.
Deleting code from Bootstrap isn't a big deal, neither is having duplicate CSS. I'd rather do that than stick dozens of little classes everywhere. FWIW, if you prefer the class approach, it's probably not too big of a change to the .less files.
I found that it was much easier to work with bootstrap if you just download the long form css version. Although it is a larger file, it is more straightforward since you can see all of the css for each element and then customize accordingly. The point of bootstrap is that it provides some nice defaults for you to work with for all elements, so you can build simple apps quickly. It is the role of the developer to customize the defaults when they do not suit the needs of the project. It honestly isn't that hard if you know a decent amount of css to quickly customize the classes to suit your own needs.
I know what you're saying. I think the intent--read it in the issue tracker or mailing list--is to put more controls into variables.less and have more of the internal stuff key off what users set in there. As it stands, for instance, you can't even set the base font family. I hope the project moves in that direction. That said, the grid, mixins and forms are a great starting point to work from already.
I just use the parts I like in .bootstrap namespace. It's freely available, and getting better all the time.