Skip to main content

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

Project details


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)

Uploaded Source

Built Distribution

cssmediaquery-0.0.1-py2.py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page