# css-mq-parser

> Parses CSS media queries

Latest version **0.0.3** (published 2015-10-01) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install css-mq-parser
pnpm add css-mq-parser
yarn add css-mq-parser
bun add css-mq-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2015-10-01 |
| First published | 2015-05-12 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Chris Rebert |
| Maintainers | cvrebert, twbs |
| Keywords | css, media, query, parse |

## Links

- npm: https://www.npmjs.com/package/css-mq-parser
- Repository: https://github.com/cvrebert/css-mq-parser
- Issues: https://github.com/cvrebert/css-mq-parser/issues
- npm.io page: https://npm.io/package/css-mq-parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2015-10-01
- 0.0.2 — 2015-05-15
- 0.0.1 — 2015-05-12

## README

# CSS Media Query Parser
[![npm version](https://img.shields.io/npm/v/css-mq-parser.svg)](https://www.npmjs.com/package/css-mq-parser)
[![Build Status](https://img.shields.io/travis/cvrebert/css-mq-parser/master.svg)](https://travis-ci.org/cvrebert/css-mq-parser)
[![Coverage Status](https://img.shields.io/coveralls/cvrebert/css-mq-parser.svg?branch=master)](https://coveralls.io/r/cvrebert/css-mq-parser)
[![devDependency Status](https://img.shields.io/david/dev/cvrebert/css-mq-parser.svg)](https://david-dm.org/cvrebert/css-mq-parser#info=devDependencies)

Parses CSS media query expressions.

## Installation

Install via npm:

```shell
$ npm install css-mq-parser
```

## Usage

This package exports one function, which can parse CSS media query expressions and return an AST.
The parser tolerates several known CSS media query browser hacks, but will throw a `SyntaxError` if the media query expression is severely malformed.
Note that this module implements a lax/liberal/non-validating parser; even modulo browser hacks, the fact that it parses a given expression successfully does not guarantee that the expression is valid per the relevant CSS specifications.

```javascript
var parseMediaQuery = require('css-mq-parser');
var ast = parseMediaQuery('screen and (min-width: 48em)');
```

The `ast` variable will have the following payload:

```json
[
    {
        "inverse": false,
        "preTypeHack": "",
        "type": "screen",
        "postTypeHack": "",
        "expressions": [
            {
                "modifier": "min",
                "feature": "width",
                "value": "48em"
            }
        ]
    }
]
```


## License & Acknowledgements

This project is a fork of [css-mediaquery](https://www.npmjs.com/package/css-mediaquery).
This software is free to use under the New/Revised BSD License.
See the [LICENSE file](https://github.com/cvrebert/css-mq-parser/blob/master/LICENSE.txt) for license text and copyright information.

---
_Source: https://npm.io/package/css-mq-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
