
Security News
Node.js Moves Toward Stable TypeScript Support with Amaro 1.0
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
css-mq-parser
Advanced tools
Parses CSS media query expressions.
Install via npm:
$ npm install css-mq-parser
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"
}
]
}
]
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.
FAQs
Parses CSS media queries
We found that css-mq-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.