You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-15
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,21 @@ Usage
23
23
This package has two exports: `parse()`, and `match()` which can parse CSS Media
24
24
Queries and determine if a media query matches a given set of values.
25
25
26
+
### Matching
27
+
28
+
The `match()` method lets you compare a media query expression with a JavaScript object and determine if a media query matches a given set of values.
29
+
30
+
```javascript
31
+
var mediaQuery =require('css-mediaquery');
32
+
33
+
var isMatch =mediaQuery.match('screen and (min-width: 40em)', {
34
+
type :'screen',
35
+
width:'1024px'
36
+
});
37
+
38
+
console.log(isMatch); // => true
39
+
```
40
+
26
41
### Parsing
27
42
28
43
Existing CSS Parsers don't do a great job at parsing the details of media queries. That's where `css-mediaquery` shines. You can parse a media query expression and get an AST back by using the `parse()` method.
@@ -54,21 +69,6 @@ The `ast` variable will have the following payload:
54
69
55
70
```
56
71
57
-
### Matching
58
-
59
-
The `match()` method lets you compare a media query expression with a JavaScript object and determine if a media query matches a given set of values.
60
-
61
-
```javascript
62
-
var mediaQuery =require('css-mediaquery');
63
-
64
-
var isMatch =mediaQuery.match('screen and (min-width: 40em)', {
65
-
type :'screen',
66
-
width:'1024px'
67
-
});
68
-
69
-
console.log(isMatch); // => true
70
-
```
71
-
72
72
This package was written with care to following the W3C Recommendations for
73
73
[CSS3 Media Queries][w3c-mq] and [CSS3 Values and Units][w3c-vu]. It supports
74
74
all of the [Media Features][w3c-mq-features] and will properly convert values to
0 commit comments