Skip to content

Commit 3d1a13c

Browse files
committed
Update to support tailwindcss v4
1 parent 0bbbb5c commit 3d1a13c

File tree

4 files changed

+380
-67
lines changed

4 files changed

+380
-67
lines changed

README.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,31 @@ layouts-css makes it a breeze to layout HTML with it's easy-to-understand CSS la
2121

2222
<hr/>
2323

24-
## Getting Started
24+
## Getting Started using tailwind V4
25+
There are two approaches
2526

26-
ℹ️ This guide assume you have Tailwind already setup and configured.
27+
#### Options 1 - (Recommended) Copy paste into your global.css
28+
Tailwind v4 introduces css based config meaning code can be shared without another npm package to download
29+
30+
* Copy everything in [layouts.css](src/layouts.css)
31+
* Paste into your `global.css`
32+
33+
💥 Boom - you're done and with one less package
34+
35+
#### Options 2 - Link in your node modules
36+
37+
`npm i -D @layouts-css/tailwindcss`
38+
39+
In `global.css` add the
40+
```
41+
@import '@layouts-css/tailwindcss-layouts/src/layouts.css';
42+
```
43+
44+
Seriously though don't do this...
45+
46+
## Getting Started using tailwind V3
47+
48+
ℹ️ This guide assume you have Tailwind v3 already setup and configure.
2749

2850
#### Install package
2951

@@ -1096,15 +1118,6 @@ Bonus
10961118

10971119
`h-max-{number}` the element can have a max height set
10981120

1099-
<br/>
1100-
1101-
### 🔲 Size
1102-
1103-
Shorthand helper class for setting the same width and height property.
1104-
1105-
`s-hug` the element hugs the width and height of it's content.
1106-
1107-
`s-fill` the element fills the remaining width and height of it's parent element.
11081121

11091122
<br/>
11101123

@@ -1139,15 +1152,6 @@ module.exports = {
11391152
- Elements without a layout class will respect default html block & inline element behavior.
11401153
- `body` & `html` both have `width` and `height` set to `100%`
11411154

1142-
<br/>
1143-
1144-
## Demo
1145-
1146-
If you are interested in comparing layouts with and without check out the following Tailwind CSS play links:
1147-
1148-
-[Without layouts-css](https://) **🚧 Coming Soon**
1149-
1150-
-[With layouts-css](https://) **🚧 Coming Soon**
11511155

11521156
<br>
11531157

@@ -1163,7 +1167,6 @@ A: Hopefully not for long
11631167
_**🚧 Coming soon**_
11641168

11651169
- [@layouts-css/plain-css](https://github.com/layouts-css/plain-css)
1166-
- [@layouts-css/vanilla-extract](https://github.com/layouts-css/vanilla-extract) (CSS in JS/TS)
11671170

11681171
<br>
11691172

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@layouts-css/tailwindcss-plugin",
3-
"version": "1.1.2",
3+
"version": "2.0.0",
44
"main": "src/index.js",
55
"types": "src/index.d.ts",
66
"repository": "https://github.com/layouts-css/tailwindcss-plugin",
@@ -10,8 +10,7 @@
1010
},
1111
"devDependencies": {
1212
"postcss": "^8.5.2",
13-
"prettier": "^3.5.1",
14-
"tailwindcss": "^3.4.17"
13+
"prettier": "^3.5.1"
1514
},
1615
"peerDependencies": {
1716
"tailwindcss": ">=3.0.0 || insiders"

src/index.js

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -109,50 +109,7 @@ const layoutCss = withOptions((options = {}) => {
109109
height: '100%',
110110
},
111111

112-
'* > .s-fill': {
113-
height: '100%',
114-
width: ['100%', '-moz-available', '-webkit-fill-available', 'stretch'],
115-
},
116-
117-
'.layout-packed-tl-x > .s-fill, .layout-packed-tc-x > .s-fill, .layout-packed-tr-x > .s-fill, .layout-packed-ml-x > .s-fill, .layout-packed-mc-x > .s-fill, .layout-packed-mr-x > .s-fill, .layout-packed-bl-x > .s-fill, .layout-packed-bc-x > .s-fill, .layout-packed-br-x > .s-fill, .layout-spaced-t > .s-fill, .layout-spaced-m > .s-fill, .layout-spaced-b > .s-fill':
118-
{
119-
alignSelf: 'stretch',
120-
flexGrow: '0',
121-
width: [
122-
'100%',
123-
'-moz-available',
124-
'-webkit-fill-available',
125-
'stretch',
126-
],
127-
},
128-
129-
'.layout-packed-tl-y > .s-fill, .layout-packed-tc-y > .s-fill, .layout-packed-tr-y > .s-fill, .layout-packed-ml-y > .s-fill, .layout-packed-mc-y > .s-fill, .layout-packed-mr-y > .s-fill, .layout-packed-bl-y > .s-fill, .layout-packed-bc-y > .s-fill, .layout-packed-br-y > .s-fill, .layout-spaced-l > .s-fill, .layout-spaced-c > .s-fill, .layout-spaced-r > .s-fill':
130-
{
131-
alignSelf: 'auto',
132-
flexGrow: '1',
133-
width: [
134-
'100%',
135-
'-moz-available',
136-
'-webkit-fill-available',
137-
'stretch',
138-
],
139-
},
140-
141-
'.layout-grid-tl > .s-fill, .layout-grid-tc > .s-fill, .layout-grid-tr > .s-fill, .layout-grid-ml > .s-fill, .layout-grid-mc > .s-fill, .layout-grid-mr > .s-fill, .layout-grid-bl > .s-fill, .layout-grid-bc > .s-fill, .layout-grid-br > .s-fill':
142-
{
143-
height: '100%',
144-
width: [
145-
'100%',
146-
'-moz-available',
147-
'-webkit-fill-available',
148-
'stretch',
149-
],
150-
},
151112

152-
'.s-initial': {
153-
height: 'initial',
154-
width: 'initial',
155-
},
156113
'.w-initial': {
157114
width: 'initial',
158115
},

0 commit comments

Comments
 (0)