unic / estatico

[DEPRECATED] Estático – Static site generator for frontend unicorns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Suggestion] Mediaqueries JS: add built in comparison

d-simon opened this issue · comments

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

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

I'll open a PR with a basic implementation.

Merged, thanks again!