# siphon-media-query

> Extract media query-specific rules from CSS

Latest version **1.0.0** (published 2016-03-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install siphon-media-query
pnpm add siphon-media-query
yarn add siphon-media-query
bun add siphon-media-query
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-03-03 |
| First published | 2016-03-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | ZURB |
| Maintainers | gakimball |
| Keywords | css, media, query |

## Links

- npm: https://www.npmjs.com/package/siphon-media-query
- Repository: https://github.com/zurb/siphon-media-query
- Homepage: https://github.com/zurb/siphon-media-query#readme
- Issues: https://github.com/zurb/siphon-media-query/issues
- npm.io page: https://npm.io/package/siphon-media-query

## Dependencies (2)

- [css-parse](https://npm.io/package/css-parse.md) ^2.0.0
- [css-stringify](https://npm.io/package/css-stringify.md) ^2.0.0

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-03-03

## README

# siphon-media-query

Extract media query-specific CSS from a stylesheet. Used by the [Foundation for Emails](http://foundation.zurb.com/emails) web inliner to separate general CSS from media query-specific CSS. Inspired by [media-query-extractor](https://www.npmjs.com/package/media-query-extractor), the main difference being this library works as a pure API.

## Installation

```bash
npm install siphon-media-query --save
```

## Usage

The parse function takes in a CSS string and gives you back a CSS string.

To extract all media queries:

```js
var parse = require('siphon-media-query');

var input = `
  .foo { color: red; }

  @media { .bar { color: dodgerblue; } }
`;

parse(input); // => @media { .bar { color: dodgerblue; } }
```

To extract only CSS from a specific media query:

```js
var input = `
  @media (min-width: 400px) {
    .foo { color: red; }
  }

  @media (min-width: 800px) {
    .bar { color: dodgerblue; }
  }
`;

parse(input, '(min-width: 800px)');
// =>
// @media (min-width: 800px) {
//   .bar { color: dodgerblue; }
// }
```

## Local Development

```bash
git clone https://github.com/zurb/siphon-media-query
cd siphon-media-query
npm install
npm test
```

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