Skip to content

Commit a9fbc9d

Browse files
committed
Adds support for grid-row span, start, end
1 parent 5724f4c commit a9fbc9d

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ The plugin generates the following sets of classes:
4040
- `.grid`, for setting `display: grid` on an element
4141
- `.grid-columns-{size}`, for specifying the number of columns in the grid
4242
- `.grid-gap-{size}`, for specifying the size of the gap between columns/rows
43-
- `.col-span-{columns}`, for specifying how wide a column should be
44-
- `.col-start-{line}` and `.col-end-{line}`, for specifying a column's start and end points explicitly (useful for reordering columns or leaving gaps)
43+
- `.col-span-{columns}`, for specifying how wide a cell should be
44+
- `.col-start-{line}` and `.col-end-{line}`, for specifying a cell's start and end points explicitly (useful for reordering cells or leaving gaps)
45+
- `.row-span-{columns}`, for specifying how tall a cell should be
46+
- `.row-start-{line}` and `.row-end-{line}`, for specifying a cell's start and end points explicitly (useful for reordering cells or leaving gaps)
4547

46-
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.
48+
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.

index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ module.exports = function ({ grids = _.range(1, 12), gaps = {}, variants = ['res
2626
gridColumnEnd: `${line}`,
2727
},
2828
})),
29+
..._.range(1, _.max(grids) + 1).map(span => ({
30+
[`.row-span-${span}`]: {
31+
gridRowStart: `span ${span}`,
32+
}
33+
})),
34+
..._.range(1, _.max(grids) + 2).map(line => ({
35+
[`.row-start-${line}`]: {
36+
gridRowStart: `${line}`,
37+
},
38+
[`.row-end-${line}`]: {
39+
gridRowEnd: `${line}`,
40+
},
41+
})),
2942
], variants)
3043
}
3144
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tailwindcss-grid",
3-
"version": "1.0.0",
3+
"version": "1.0.2",
44
"description": "CSS grid plugin for tailwindcss framework",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)