Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
bourbon-neat
Advanced tools
Note: This branch is an archive of Neat v1. The current release is v2 on
master
.
Neat is a fluid grid framework with the aim of being easy enough to use out of the box and flexible enough to customize down the road.
Follow the @bourbonsass Twitter account for updates.
For command line help, visit our wiki page on Neat’s command line interface.
gem install neat
Alternatively, you can install Neat with Bower.
gem install sass # or gem update sass
neat install
@import "neat/neat";
It’s not recommended to add or modify the Neat files so that you can update them easily.
gem 'neat'
bundle install
If you see the error Bundler could not find compatible versions for gem "sass"
, run:
bundle update sass
application.scss
:@import "neat";
It should be noted that @import
rules are not compatible with Sprockets directives. You need to use one or the other.
npm install --save bourbon-neat
If you’re using Eyeglass, skip to Step 3. Otherwise, you’ll need to add Neat to your node-sass includePaths
option. require("bourbon-neat").includePaths
is an array of directories that you should pass to node-sass. How you do this depends on how node-sass is integrated into your project.
Import Neat into your Sass files:
@import "neat";
gem uninstall neat
-v
flag to specify the version you need:gem install neat -v 1.7.0
First off, if you are planning to override the default grid settings (12 columns), it is recommended to create a _grid-settings.scss
file for that purpose. Make sure to import it right before importing Neat:
@import "grid-settings";
@import "neat/neat"; // or "neat" when in Rails
In your newly created _grid-settings.scss
, import neat-helpers
if you are planning to use new-breakpoint()
, then define your new variables:
@import "neat/neat-helpers"; // or "neat-helpers" when in Rails
// Change the grid settings
$column: 90px;
$gutter: 30px;
$grid-columns: 10;
$max-width: 1200px;
// Define your breakpoints
$tablet: new-breakpoint(max-width 768px 8);
$mobile: new-breakpoint(max-width 480px 4);
See the docs for a full list of settings.
Next, include the outer-container
mixin in the topmost container (to which the max-width
setting will be applied):
div.container {
@include outer-container;
}
Then use span-columns
on any element to specify the number of columns it should span:
div.element {
@include span-columns(6);
}
If the element’s parent isn’t the top-most container, you need to add the number of columns of the parent element to keep the right proportions:
div.container {
@include outer-container;
div.parent-element {
@include span-columns(8);
div.element {
@include span-columns(6 of 8);
}
}
}
To make your layout responsive, use the media()
mixin to modify both the grid and the layout:
.my-class {
@include media($mobile) { // As defined in _grid-settings.scss
@include span-columns(2);
}
}
// Compiled CSS
@media screen and (max-width: 480px) {
.my-class {
display: block;
float: left;
margin-right: 7.42297%;
width: 46.28851%; // 2 columns of the total 4 in this media context
}
.my-class:last-child {
margin-right: 0;
}
}
By setting $visual-grid
to true
in a file that is imported before
neat-helpers
(or prior to neat
itself if you are using the default
breakpoints), you can display the base grid in the background (default) or as an
overlay. You can even change the color and opacity of the grid-lines by
overriding the default settings as detailed in the section below.
The visual grid reflects the changes applied to the grid via the new-breakpoint()
mixin, as long as the media contexts are defined before importing Neat.
omega()
in a mobile-first workflow?Using omega()
with an nth-child
pseudo selector in a mobile-first workflow will cause the style to be applied to wider-viewport media queries as well. That is the cascading nature of CSS.
One solution would be to provide an omega-reset()
mixin that negates the effect of omega()
on that specific nth-child
pseudo selector. While this is often the most suggested solution, it is also a lazy hack that outputs ugly code and can quickly get out of hand in complex layouts. As a general rule, having to undo CSS styles is a sign of poor stylesheet architecture (more about CSS code smells).
The other, more elegant, solution is to use mutually exclusive media queries, also referred to as media-query
splitting. This would guarantee that omega()
styles are only applied where desired.
$first-breakpoint-value: 400px;
$second-breakpoint-value: 700px;
$medium-viewport: new-breakpoint(min-width $first-breakpoint-value max-width $second-breakpoint-value);
$large-viewport: new-breakpoint(min-width $second-breakpoint-value + 1);
.element {
@include media($medium-viewport) {
@include span-columns(6);
@include omega(2n);
}
@include media($large-viewport) {
@include span-columns(4);
@include omega(3n);
}
}
If, for some reason, you still think that omega-reset
is the only way you want to go, check out Josh Fry’s omega-reset.
The visual grid is built using CSS gradients whose stops might contain decimal values depending on the default settings of your grid. In order to render the gradient, browsers round the pixel values since they can’t deal with pixel fractions.
As a result the visual grid might be few pixels off in some browsers. The result is also inconsistent across browsers. For best results, preview your website on Firefox as it renders closest to the expected outcome.
At this point, writing an internal rounding mechanism is not high priority.
Unless you open a pull request, the answer is most likely going to be no. Neat is lightweight and simple compared to other grid frameworks, and strives to remain so. We have plans for adding new features in future versions of the framework, but these will be most likely to support new ways of working with layouts on the Web, not patches to existing ones.
media()
support)Copyright © 2012–2015 thoughtbot, inc. Neat is free software, and may be redistributed under the terms specified in the license.
Neat is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.
We love open source software! See our other projects or hire us to design, develop, and grow your product.
FAQs
A lightweight, semantic grid framework
The npm package bourbon-neat receives a total of 9,031 weekly downloads. As such, bourbon-neat popularity was classified as popular.
We found that bourbon-neat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.