Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

siphon-media-query

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

siphon-media-query

Extract media query-specific rules from CSS

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

siphon-media-query

Extract media query-specific CSS from a stylesheet. Used by the Foundation for Emails web inliner to separate general CSS from media query-specific CSS. Inspired by media-query-extractor, the main difference being this library works as a pure API.

Installation

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:

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:

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

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

Keywords

FAQs

Package last updated on 03 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc