media-query-solver
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

media-query-solver

npm npm type definitions license npm downloads install size

Solve media queries (and detect useless ones!)

Try with npx:

npx media-query-solver 'not all, ((width > 100px) or (monochrome))'

cli output

Install

This package is available from the npm registry.

npm install media-query-solver

Usage

Supports JavaScript + TypeScript:

import { solveMediaQueryList } from "media-query-solver";

solveMediaQueryList(`not all`);
// => "false"
solveMediaQueryList(`all`);
// => "true"
solveMediaQueryList(`(width > 100px)`);
// => "unknown"
solveMediaQueryList(`(width > 100px)`, {
  solveUnknownFeature: () => "true",
});
// => "true"

Can also be imported via require("media-query-solver").

Contributing

  • PRs welcome and accepted, simply fork and create
  • Issues also very welcome
  • Treat others with common courtesy and respect 🤝

Dev environment (for contributing) requires:

  • node >= 16.14.0
  • npm >= 6.8.0
  • git >= 2.11

Licence

MIT

Package Sidebar

Install

npm i media-query-solver

Weekly Downloads

20

Version

0.1.3

License

MIT

Unpacked Size

55.6 kB

Total Files

36

Last publish

Collaborators

  • tbjgolden