-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Ryan Domingue edited this page Sep 27, 2019
·
10 revisions
Demo page: https://goodguyry.github.io/postcss-tidy-columns/
npm install postcss-tidy-columns
There are two ways to define the Tidy grid values:
Option 1. Pass grid settings in JavaScript via the plugin options
/* postcss.config.js */
const tidyColumns = require('postcss-tidy-columns');
plugins: [
tidyColumns({
columns: 8,
gap: '0.625rem',
edge: '1.25rem',
breakpoints: {
'64rem': {
columns: 12,
siteMax: '90rem',
gap: '1.25rem',
edge: '1.5rem',
},
},
}),
];
Option 2. Declare @tidy
rules in your CSS/Sass file.
/* index.css */
@tidy columns 12;
@tidy siteMax 90rem;
@tidy gap 1.25rem;
@tidy edge 1.5rem;
Note: Passing JS values directly to the plugin allows for declaring breakpoint configurations.
- Click outside the design, in the art board area.
- Notice the Grid section in the sidebar.
- The
columns
value is the # of Columns. - The
gap
value is the dark colored portion of the Grid (20px
in the screenshot below). - The
edge
value is the actual width of the design minus the Total Width value here, divided by two. Or by simply measuring with a tool like PixelSnap or Linear. - The
siteMax
value is theedge
value multiplied by 2 plus the Total Width field (or simply the full-width of the design).
- Click outside the design, in the art board area.
- Notice the Grid section in the sidebar.
- The
columns
value is in the Columns field. - The
gap
value is in the Gutter width field. - The
edge
value is calculated by subtracting the Offset value from the Total Width value, then subtracting the result from the Width value (at the top of the sidebar). Or by simply measuring with a tool like PixelSnap or Linear. - The
siteMax
value is the Width value (at the top of the sidebar).
In the View toolbar drop down, notice the Layout Settings... option.
That option opens the Layout settings.
- The
columns
value is the Number of Columns field. - The
gap
value is the Gutter Width field. - The
edge
value is theOffset
field. - The
siteMax
value is the Offset field multiplied by 2 plus the Total Width field (or simply the full-width of the design).