media-engine
Media queries engine written in pure JS!

Install
npm install media-engine --save
yarn add media-engine
API
min-height
matchMedia(
{
'@media min-height: 700': {
color: 'green',
},
},
{ height: 800 }
);
matchMedia(
{
'@media min-height: 700': {
color: 'green',
},
},
{ height: 100 }
);
max-height
matchMedia(
{
'@media max-height: 700': {
color: 'green',
},
},
{ height: 100 }
);
matchMedia(
{
'@media max-height: 700': {
color: 'green',
},
},
{ height: 800 }
);
min-width
matchMedia(
{
'@media min-width: 700': {
color: 'green',
},
},
{ width: 800 }
);
matchMedia(
{
'@media min-width: 700': {
color: 'green',
},
},
{ width: 100 }
);
max-width
matchMedia(
{
'@media max-width: 700': {
color: 'green',
},
},
{ width: 100 }
);
matchMedia(
{
'@media max-width: 700': {
color: 'green',
},
},
{ width: 800 }
);
orientation
matchMedia(
{
'@media orientation: landscape': {
color: 'green',
},
},
{ orientation: 'landscape' }
);
matchMedia(
{
'@media orientation: landscape': {
color: 'green',
},
},
{ orientation: 'portrait' }
);
and operator
matchMedia(
{
'@media (min-width: 700) and (orientation: landscape)': {
color: 'green',
},
},
{ width: 800, orientation: 'landscape' }
);
or operator
matchMedia(
{
'@media (min-width: 700), (orientation: landscape)': {
color: 'green',
},
},
{ orientation: 'landscape' }
);
multiple queries
matchMedia(
{
'@media orientation: landscape': {
color: 'green',
},
'@media min-width: 700': {
background: 'red',
}
},
{ orientation: 'landscape', width: 800 }
);
License
MIT © Diego Muracciole