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

css-mq-parser

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-mq-parser

Parses CSS media queries

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
198
decreased by-86.66%
Maintainers
2
Weekly downloads
 
Created
Source

CSS Media Query Parser

npm version Build Status Coverage Status devDependency Status

Parses CSS media query expressions.

Installation

Install via npm:

$ 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.

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

The ast variable will have the following payload:

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

License & Acknowledgements

This project is a fork of css-mediaquery. This software is free to use under the New/Revised BSD License. See the LICENSE file for license text and copyright information.

Keywords

FAQs

Package last updated on 01 Oct 2015

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