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

css-mediaquery

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-mediaquery

Parses and determines if a given CSS Media Query matches a set of values.

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is css-mediaquery?

The css-mediaquery package is a tool for parsing and evaluating CSS media queries. It is useful for determining if a media query matches a given set of values or for extracting information from media query strings. This can be particularly helpful for server-side rendering, where you might want to match styles to a device's characteristics, or for dynamically adjusting UI components in JavaScript based on media query logic.

What are css-mediaquery's main functionalities?

Parsing media queries

This feature allows you to parse a CSS media query string into a structured format that can be easily manipulated or evaluated in JavaScript.

const cssMediaQuery = require('css-mediaquery');
const parsedQuery = cssMediaQuery.parse('screen and (min-width: 480px)');
console.log(parsedQuery);

Evaluating media queries

This feature enables you to evaluate whether a media query matches a given set of values, such as the type of device or the viewport width. This is useful for conditionally applying styles or functionality.

const cssMediaQuery = require('css-mediaquery');
const matches = cssMediaQuery.match('screen and (min-width: 480px)', {
  type: 'screen',
  width: '1024px'
});
console.log(matches); // true or false

Other packages similar to css-mediaquery

Keywords

FAQs

Package last updated on 21 Jan 2014

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