Skip to content

Commit 7edb690

Browse files
committed
Add basic docs to README
1 parent b16a112 commit 7edb690

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,38 @@ Parses and determines if a given CSS Media Query matches a set of values via
99
JavaScript.
1010

1111

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+
1244
License
1345
-------
1446

0 commit comments

Comments
 (0)