Skip to content

Commit eae0734

Browse files
committed
Tweak Usage section of README
1 parent 71b49d5 commit eae0734

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

README.md

+23-15
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ JavaScript.
1111
Installation
1212
------------
1313

14-
Install via npm
14+
Install via npm:
1515

16-
```
17-
npm install css-mediaquery
16+
```shell
17+
$ npm install css-mediaquery
1818
```
1919

2020
Usage
@@ -39,25 +39,38 @@ var isMatch = mediaQuery.match('screen and (min-width: 40em)', {
3939
console.log(isMatch); // => true
4040
```
4141

42+
The values specified to check a media query string against should be thought of
43+
as if they are the current state of a device/browser. A `type` value _must_ be
44+
specified, and it can _not_ be `"all"`.
45+
4246
### Parsing
4347

4448
Existing CSS Parsers don't do a great job at parsing the details of media
4549
queries. That's where `css-mediaquery` shines. You can parse a media query
4650
expression and get an AST back by using the `parse()` method.
4751

4852
```javascript
49-
50-
var mediaQuery = require('css-mediaquery');
51-
52-
var ast = mediaQuery.parse('screen and (min-width: 48em)');
53+
var mediaQuery = require('css-mediaquery'),
54+
ast = mediaQuery.parse('screen and (min-width: 48em)');
5355
```
5456

5557
The `ast` variable will have the following payload:
5658

5759
```javascript
58-
[ { inverse: false, type: 'screen', expressions: [
59-
{ modifier: 'min', feature: 'width', value: '48em' }
60-
] } ]
60+
[
61+
{
62+
inverse: false,
63+
type : 'screen',
64+
65+
expressions: [
66+
{
67+
modifier: 'min',
68+
feature : 'width',
69+
value : '48em'
70+
}
71+
]
72+
}
73+
]
6174
```
6275

6376
This package was written with care to following the W3C Recommendations for
@@ -66,11 +79,6 @@ all of the [Media Features][w3c-mq-features] and will properly convert values to
6679
a common unit before comparing them.
6780

6881

69-
The values specified to check a media query string against should be thought of
70-
as if they are the current state of a device/browser. A `type` value _must_ be
71-
specified, and it can _not_ be `"all"`.
72-
73-
7482
[w3c-mq]: http://www.w3.org/TR/css3-mediaqueries/
7583
[w3c-mq-features]: http://www.w3.org/TR/css3-mediaqueries/#media1
7684
[w3c-vu]: http://www.w3.org/TR/css3-values/

0 commit comments

Comments
 (0)