![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
McGriddle is a get-out-of-your-way Sass library designed to help you build based a grid system. Suports flexbox (the grid is based on floats, by default). Set up your grid system…
$grid-width : 64em;
$grid-gutter : 1.875em;
$grid-columns: 12;
…and you’re ready to build.
<section class="container">
<article class="article"></article>
<div class="sidebar"></div>
</section>
.container { @include container; }
.article { @include columns(8); }
.sidebar { @include columns(4, last); }
npm install mcgriddle
yarn add mcgriddle
bower install mcgriddle
Also available as a Ruby gem to use within your Rails application—see below for more information.
Or to manually install it, download and unzip the source files. Then copy the files from the _sass/mcgriddle
directory into your project.
_mcgriddle.scss
file in your Sass manifest file:@import "mcgriddle";
gem 'mcgriddle'
bundle install
.@import
*// application.scss
@import "mcgriddle";
* More information on why Sass’s native @import
+ why you should ditch Sprockets directives altogether.
First, create a settings file (_mcgriddle-settings.scss
) and import it before importing McGriddle.
@import "mcgriddle-settings";
@import "mcgriddle";
Then edit the settings file to customize/override default grid settings. The following is a list of settings and its defaults:
$grid-width : 64em;
$grid-gutter : 1.875em;
$grid-columns : 12;
$grid-minor : 1/3;
$grid-collapse : false;
$grid-rtl : false;
$grid-flexbox : false;
$grid-flexbox-wrap : wrap;
$grid-flexbox-justify: flex-start;
Features:
container()
You’ll need a container to wrap the columns in.
.container {
@include container;
}
// Container with no max width ($grid-width)
.container--full {
@include container(false);
}
columns()
Then use columns()
on an element to specify how many columns wide it should be.
.column {
@include columns(8);
}
.column-decimal {
@include columns(5.6);
}
// Last column
.column-last {
@include columns(4, last);
}
// Centered column
.column-center {
@include columns(8, center);
}
// Relative columns
.column-4-9 {
@include columns(4 of 9);
}
.column-5-9 {
@include columns(5 of 9, last);
}
Nest columns by wrapping nested columns in a container.
<div class="container">
<div class="columns-9">
<div class="container">
<div class="columns-6"></div>
<div class="columns-6"></div>
</div>
</div>
<div class="columns-3"></div>
</div>
Push an element however many columns with shift()
.
// Shift a column over 2 columns
.column {
@include columns(6);
@include shift(2);
}
$grid-collapse
Collapse gutters: $grid-collapse: true
. (Default is false
)
$grid-collapse: true;
.container { @include container; }
$grid-flexbox
Flexbox support (as opposed to floats): $grid-flexbox: true
. (Default is false
)
$grid-flexbox: true;
.container { @include container; }
$grid-rtl
Right-to-left support for RTL languages: $grid-rtl: true
. (Default is false
)
$grid-rtl: true;
.container { @include container; }
Be sure to read the documentation for a full list of settings, mixins and functions.
The documentation is still a work-in-progress, so there are features and functionality that have yet to be properly documented. I also have a couple more features I’d like to build (when and if I decide to), but aside from that… yep, that’s it.
I originally created McGriddle for me—I wanted something stupid simple and straight forward. Therefore if you’re looking for something more robust, I’d suggest Bourbon Neat or Susy.
[0.5.0] - 11/30/2016
FAQs
A get-out-of-your-way Sass grid library. Supports flexbox.
The npm package mcgriddle receives a total of 179 weekly downloads. As such, mcgriddle popularity was classified as not popular.
We found that mcgriddle demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.