Drink in the Responsive Grid With ‘Bourbon Neat’
Sadly, it’s nearly impossible to create a reusable, responsive grid that doesn’t litter your HTML with grid-specific class names. Even if the non-semantic class names don’t bother you, there’s no getting around the fact that it’s a pain to update and maintain that code.
The solution is to step back from the CSS and turn to a CSS pre-processor like SASS.
That’s what Bourbon Neat does to create one of the easiest to use SASS-based fluid grid systems we’ve come across. The clever name comes from the fact that Neat relies on the Bourbon SASS library and extends it to create a fluid, em-based grid framework.
The project was created by the developers at Thoughtbot.com. Here’s what the docs have to say:
Why another grid framework?
Because we are not happy with other frameworks. We built Neat with the aim of promoting clean and semantic markup; it relies entirely on SASS mixins and does not pollute your HTML with presentation classes and extra wrapping divs.
Using SASS 3.2 block mixins, Neat makes it extremely easy to build responsive layouts… Using the breakpoint() mixin, you can change the number of columns in the grid for each media query and even store these values in project-wide variables to DRY up your code.
To give it a try, just install Neat and its dependencies and check out the guide to using Neat over on GitHub. Be sure to look over the example page to get an idea of what you can do with Neat and how it works. If you’re a Rails developer there’s a Neat gem you can install.
The power of Bourbon Neat lies in some new features in SASS 3.2, namely block mixins, which allow you to use the
@mixin syntax to “name” media queries. To see how Bourbon is using that feature, check out the source code on GitHub.