CSS Media Query parser and matcher
Project description
## css-mediaquery
Parses and determines if a given CSS Media Query matches a set of values.
This is a port of https://github.com/ericf/css-mediaquery.
### Usage
```python
from cssmediaquery import match, parse
isamatch = match('screen and (min-width: 40em)', {
'type' : 'screen',
'width' : '1024px'
})
# returns True
ast = parse('screen and (min-width: 40em)')
print ast
# [
# {
# 'inverse': 'false',
# 'type' : 'screen',
# 'expressions': [{
# 'modifier': 'min',
# 'feature': 'width',
# 'value': '40em'
# }]
# }
# ]
```
### Installing
$ pip install cssmediaquery
### Running Tests
python tests.py -v
Parses and determines if a given CSS Media Query matches a set of values.
This is a port of https://github.com/ericf/css-mediaquery.
### Usage
```python
from cssmediaquery import match, parse
isamatch = match('screen and (min-width: 40em)', {
'type' : 'screen',
'width' : '1024px'
})
# returns True
ast = parse('screen and (min-width: 40em)')
print ast
# [
# {
# 'inverse': 'false',
# 'type' : 'screen',
# 'expressions': [{
# 'modifier': 'min',
# 'feature': 'width',
# 'value': '40em'
# }]
# }
# ]
```
### Installing
$ pip install cssmediaquery
### Running Tests
python tests.py -v
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cssmediaquery-0.0.1.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for cssmediaquery-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 373c7beb26fe45349e0954a05d7b81babe0b61462076891c1ce61f7d55b9bfdd |
|
MD5 | 8996fb7c77d6cc0574792428b4107a36 |
|
BLAKE2b-256 | a80b024b36535cb90e676bed6956783fb173b71a9e594e156d6d59c2f23146d9 |