Skip to content
This repository was archived by the owner on Apr 1, 2022. It is now read-only.

Commit ff6d9e7

Browse files
committed
updated README.md
1 parent 8a3f662 commit ff6d9e7

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,48 @@
11
# postcss-responsify
2-
[PostCSS](https://github.com/postcss/postcss) plugin to create responsive classes for all styles within a `@responsive {}` rule.
2+
[PostCSS](https://github.com/postcss/postcss) plugin to create responsive classes with the `@responsive` rule.
3+
4+
```javascript
5+
const postcss = require('postcss');
6+
const responsify = require('postcss-responsify');
7+
8+
const breakpoints = [
9+
{ prefix: 'sm-', mediaQuery: '(min-width: 40em)' },
10+
{ prefix: 'md-', mediaQuery: '(min-width: 52em)' },
11+
]
12+
postcss()
13+
.use(responsify()({
14+
breakpoints
15+
}));
16+
```
17+
18+
**PostCSS**
19+
```css
20+
@responsive {
21+
.col { float: left; box-sizing: border-box; }
22+
.col-1 { width: calc(1/12 * 100%); }
23+
.col-2 { width: calc(2/12 * 100%); }
24+
.col-3 { width: calc(2/12 * 100%); }
25+
}
26+
```
27+
28+
**CSS**
29+
```css
30+
.col { float: left; box-sizing: border-box; }
31+
.col-1 { width: calc(1/12 * 100%); }
32+
.col-2 { width: calc(2/12 * 100%); }
33+
.col-3 { width: calc(2/12 * 100%); }
34+
35+
@media (min-width: 40em) {
36+
.sm-col { float: left; box-sizing: border-box; }
37+
.sm-col-1 { width: calc(1/12 * 100%); }
38+
.sm-col-2 { width: calc(2/12 * 100%); }
39+
.sm-col-3 { width: calc(2/12 * 100%); }
40+
}
41+
42+
@media (min-width: 52em) {
43+
.md-col { float: left; box-sizing: border-box; }
44+
.md-col-1 { width: calc(1/12 * 100%); }
45+
.md-col-2 { width: calc(2/12 * 100%); }
46+
.md-col-3 { width: calc(2/12 * 100%); }
47+
}
48+
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "postcss-responsify",
33
"version": "1.0.0",
4-
"description": "Easily create responsive classes",
4+
"description": "PostCSS plugin to automatically create responsive classes with at-rules",
55
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"

0 commit comments

Comments
 (0)