Skip to content

Commit 1939865

Browse files
committed
Update docs, Remove the redundant code
1 parent 8229bb0 commit 1939865

4 files changed

Lines changed: 54 additions & 22 deletions

File tree

README-zh.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ input.css:
7676
| <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>
7777
```
7878

79+
PostCSS Media Minmax 目前并没有实现 `200px >= width` 或者 `200px <= width` 这样的语法,因为这样的语法可读性并不不是太好。
80+
7981
## [取值(Values)](http://dev.w3.org/csswg/mediaqueries/#values)
8082

8183
**The special values:**
8284

8385
* [<ratio>](http://dev.w3.org/csswg/mediaqueries/#typedef-ratio)
8486

85-
The <ratio> value type is a positive (not zero or negative) <integer> followed by optional whitespace, followed by a solidus ('/'), followed by optional whitespace, followed by a positive <integer>. <ratio>s can be ordered or compared by transforming them into the number obtained by dividing their first <integer> by their second <integer>.
87+
<ratio> 是一个正(非零非负)的 <integer>(整型)取值,其后跟随0个或多个空白,接着跟随一个斜线(“/”),再跟随0个或多个空白,最后跟随一个正<integer>
8688

8789
```css
8890
@media screen and (device-aspect-ratio: 16 / 9) {
@@ -97,7 +99,7 @@ input.css:
9799

98100
* [<mq-boolean>](http://dev.w3.org/csswg/mediaqueries/#typedef-mq-boolean)
99101

100-
The <mq-boolean> value type is an <integer> with the value 0 or 1. Any other integer value is invalid. Note that -0 is always equivalent to 0 in CSS, and so is also accepted as a valid <mq-boolean> value.
102+
<mq-boolean> 值是一个 0 或 1 的 <integer>(整型)取值。其他任何整数无效。注意, 在 CSS 中 -0 总是等价于 0 的,所以也作为一种有效的 <mq-boolean> 取值。
101103

102104
```css
103105
@media screen and (grid: -0) {

README.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
> Writing simple and graceful Media Queries!
55
6-
The `min-width`,`max-width` and so on propertys of Media Queries is really easy to confuse, every time I see them, I want to cry. Right now in the new specs, you can use more intuitive <= or >= to instead of the min-/max- prefix of media queries.
6+
The `min-width`,`max-width` and many other propertys of Media Queries are really confused, every time I see them, I want to cry. Right now in the new specs, you can use more intuitive <= or >= to instead of the min-/max- prefix of media queries.
77

8-
This is a supporting CSS Media Queries Level 4 Polyfill plugin,which let you can ues these features right now. Mom won't never worry about my study, so amazing!
8+
This is a supporting [CSS Media Queries Level 4](http://dev.w3.org/csswg/mediaqueries/) Polyfill plugin,which let you can ues these features right now. Mom won't never worry about my study, so amazing!
99

1010

1111
[简体中文](README-zh.md)
@@ -68,19 +68,56 @@ You will get:
6868

6969
## CSS syntax
7070

71+
### [Syntax](http://dev.w3.org/csswg/mediaqueries/#mq-syntax)
72+
7173
```
7274
<mf-range> = <mf-name> [ '<' | '>' ]? '='? <mf-value>
7375
| <mf-value> [ '<' | '>' ]? '='? <mf-name>
7476
| <mf-value> '<' '='? <mf-name> '<' '='? <mf-value>
7577
| <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>
7678
```
7779

80+
PostCSS Media Minmax is currently doesn't implement the `200px > = width` or `200px < = width` such a grammar, because the syntax readability this not too good.
81+
82+
## [Values](http://dev.w3.org/csswg/mediaqueries/#values)
83+
84+
**The special values:**
85+
86+
* [<ratio>](http://dev.w3.org/csswg/mediaqueries/#typedef-ratio)
87+
88+
The <ratio> value type is a positive (not zero or negative) <integer> followed by optional whitespace, followed by a solidus ('/'), followed by optional whitespace, followed by a positive <integer>. <ratio>s can be ordered or compared by transforming them into the number obtained by dividing their first <integer> by their second <integer>.
89+
90+
```css
91+
@media screen and (device-aspect-ratio: 16 / 9) {
92+
/* rules */
93+
}
94+
95+
/* equivalent to */
96+
@media screen and (device-aspect-ratio: 16/9) {
97+
/* rules */
98+
}
99+
```
100+
101+
* [<mq-boolean>](http://dev.w3.org/csswg/mediaqueries/#typedef-mq-boolean)
102+
103+
The <mq-boolean> value type is an <integer> with the value 0 or 1. Any other integer value is invalid. Note that -0 is always equivalent to 0 in CSS, and so is also accepted as a valid <mq-boolean> value.
104+
105+
```css
106+
@media screen and (grid: -0) {
107+
/* rules */
108+
}
109+
110+
/* equivalent to */
111+
@media screen and (grid: 0) {
112+
/* rules */
113+
}
114+
```
78115

79116
## How to use
80117

81118
### Shorthand
82119

83-
In Example 1, the same feature name is `>=` and `<=`, which will be abbreviated as the following:
120+
In Example 1, the same feature name is >= and <=, which will be abbreviated as the following:
84121

85122
```css
86123
@media screen and (500px <= width <= 1200px) {
@@ -106,7 +143,7 @@ Will get the same output results:
106143
}
107144
```
108145

109-
**Note**: when the feature name in the middle, we must ensure that two `<=` or `>=` in the same direction, otherwise which will not be converted.
146+
**Note**: When the Media features name in the middle, we must ensure that two `<=` or `>=` in the same direction, otherwise which will not be converted.
110147

111148
E.g. in the example below, width is greater than or equal to 500px and is greater than or equal to 1200px, this is the wrong in grammar and logic.
112149

@@ -119,7 +156,7 @@ E.g. in the example below, width is greater than or equal to 500px and is greate
119156
}
120157
```
121158

122-
### feature name
159+
### Media features name
123160

124161
The following property supports the min-/max prefix in specification at present, which will be automatically converted by PostCSS Media Minmax.
125162

@@ -142,7 +179,7 @@ The following property supports the min-/max prefix in specification at present,
142179
var fs = require('fs')
143180
var chokidar = require('chokidar')
144181
var postcss = require('postcss')
145-
var minmax = require('minmax')
182+
var minmax = require('postcss-media-minmax')
146183
var customMedia = require('postcss-custom-media')
147184

148185
var src = 'input.css'

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "postcss-media-minmax",
33
"version": "1.0.0",
4-
"description": "Writing simple and graceful Media Queries!Using more intuitive `>=` or `<=` instead of media queries min/max prefix.",
5-
"main": "index.js",
4+
"description": "Using more intuitive `>=` or `<=` instead of media queries min/max prefix.",
65
"scripts": {
76
"test": "tape test"
87
},
@@ -15,12 +14,14 @@
1514
"css3",
1615
"postcss",
1716
"postcss-plugins",
18-
"Media Queries"
17+
"media querie",
18+
"media queries"
1919
],
2020
"author": "yisi",
2121
"license": "MIT",
2222
"files": [
2323
"CHANGELOG.md",
24+
"README.md",
2425
"README-zh.md",
2526
"LICENSE",
2627
"index.js"

test/index.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function compareFixtures(t, name, msg, opts, postcssOpts) {
2020

2121
test("@media", function(t) {
2222
compareFixtures(t, "width-height", "should transform")
23-
compareFixtures(t, "device-width-height", "should transform")
23+
compareFixtures(t, "device-width-height", "should transform")
2424
compareFixtures(t, "aspect-ratio", "should transform")
2525
compareFixtures(t, "device-aspect-ratio", "should transform")
2626
compareFixtures(t, "color", "should transform")
@@ -29,17 +29,9 @@ test("@media", function(t) {
2929
compareFixtures(t, "resolution", "should transform")
3030

3131
compareFixtures(t, "comment", "should transform")
32-
compareFixtures(t, "comment", "should transform")
33-
compareFixtures(t, "line-break", "should transform")
32+
compareFixtures(t, "line-break", "should transform")
3433
compareFixtures(t, "other-name", "should transform")
35-
compareFixtures(t, "more-units", "should transform")
36-
37-
// compareFixtures(t, "extension", "local extensions", {
38-
// extensions: {
39-
// ':--any' : 'section, article, aside, nav',
40-
// '--foo': 'input[type="text"] > section, #nav .bar'
41-
// }
42-
// })
34+
compareFixtures(t, "more-units", "should transform")
4335

4436
t.end()
4537
})

0 commit comments

Comments
 (0)