Skip to content

Commit

Permalink
Adds support for grid-row span, start, end
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrowe committed Jul 10, 2018
1 parent 5724f4c commit a9fbc9d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ The plugin generates the following sets of classes:
- `.grid`, for setting `display: grid` on an element
- `.grid-columns-{size}`, for specifying the number of columns in the grid
- `.grid-gap-{size}`, for specifying the size of the gap between columns/rows
- `.col-span-{columns}`, for specifying how wide a column should be
- `.col-start-{line}` and `.col-end-{line}`, for specifying a column's start and end points explicitly (useful for reordering columns or leaving gaps)
- `.col-span-{columns}`, for specifying how wide a cell should be
- `.col-start-{line}` and `.col-end-{line}`, for specifying a cell's start and end points explicitly (useful for reordering cells or leaving gaps)
- `.row-span-{columns}`, for specifying how tall a cell should be
- `.row-start-{line}` and `.row-end-{line}`, for specifying a cell's start and end points explicitly (useful for reordering cells or leaving gaps)

It's not really practical to expose all of the power of CSS Grid through utilities, but this plugin is a good example of using CSS Grid to replace a column-only float or Flexbox grid.
It's not really practical to expose all of the power of CSS Grid through utilities, but this plugin is a good example of using CSS Grid to replace a cell-only float or Flexbox grid.
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ module.exports = function ({ grids = _.range(1, 12), gaps = {}, variants = ['res
gridColumnEnd: `${line}`,
},
})),
..._.range(1, _.max(grids) + 1).map(span => ({
[`.row-span-${span}`]: {
gridRowStart: `span ${span}`,
}
})),
..._.range(1, _.max(grids) + 2).map(line => ({
[`.row-start-${line}`]: {
gridRowStart: `${line}`,
},
[`.row-end-${line}`]: {
gridRowEnd: `${line}`,
},
})),
], variants)
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tailwindcss-grid",
"version": "1.0.0",
"version": "1.0.2",
"description": "CSS grid plugin for tailwindcss framework",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a9fbc9d

Please sign in to comment.