unic / estatico

[DEPRECATED] Estático – Static site generator for frontend unicorns
Other
121 stars 18 forks source link

[Suggestion] Mediaqueries JS: add built in comparison #4

Closed d-simon closed 8 years ago

d-simon commented 9 years ago

We're finding the current syntax for media queries in JS – which is a nice feature btw – a bit tedious.

// Recommended by the docs. (Side note: The radix is missing in the parseInt)
if (parseInt(schaeferag.mq.currentBreakpoint.value) > parseInt(schaeferag.mq.breakpoints.small)) {
    // ... 
}

What if estatico offered a built in comparison function like so:

// Greater than
estatico.mq.gt('small'); // true
// Lesser than
estatico.mq.lt('small'); // false

// Or maybe a similar syntax to the Sass mixin.
estatico.mq.query({ to: 'small' }); // false
estatico.mq.query({ from: 'small', to: 'medium' }); // true
backflip commented 9 years ago

This is definitely something we want to do and I like the query approach.

d-simon commented 9 years ago

I'll open a PR with a basic implementation.

backflip commented 8 years ago

Merged, thanks again!