File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,38 @@ Parses and determines if a given CSS Media Query matches a set of values via
9
9
JavaScript.
10
10
11
11
12
+ Usage
13
+ -----
14
+
15
+ This package has two exports: ` parse() ` , and ` match() ` which can parse CSS Media
16
+ Queries and determine if a media query matches a given set of values.
17
+
18
+ ``` javascript
19
+ var mediaQuery = require (' css-mediaquery' );
20
+
21
+ var isMatch = mediaQuery .match (' screen and (min-width: 40em)' , {
22
+ type : ' screen' ,
23
+ width: ' 1024px'
24
+ });
25
+
26
+ console .log (isMatch); // => true
27
+ ```
28
+
29
+ This package was written with care to following the W3C Recommendations for
30
+ [ CSS3 Media Queries] [ w3c-mq ] and [ CSS3 Values and Units] [ w3c-vu ] . It supports
31
+ all of the [ Media Features] [ w3c-mq-features ] and will properly convert values to
32
+ a common unit before comparing them.
33
+
34
+ The values specified to check a media query string against should be thought of
35
+ as if they are the current state of a device/browser. A ` type ` value _ must_ be
36
+ specified, and it can _ not_ be ` "all" ` .
37
+
38
+
39
+ [ w3c-mq ] : http://www.w3.org/TR/css3-mediaqueries/
40
+ [ w3c-mq-features ] : http://www.w3.org/TR/css3-mediaqueries/#media1
41
+ [ w3c-vu ] : http://www.w3.org/TR/css3-values/
42
+
43
+
12
44
License
13
45
-------
14
46
You can’t perform that action at this time.
0 commit comments