unic / estatico

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

[Feature] mq.query: Add js mediaquery #5

Closed d-simon closed 8 years ago

d-simon commented 9 years ago

Allows for js-based mediaqueries as described in #4 :

estatico.mq.query({ to: 'small' }); // false
estatico.mq.query({ from: 'small' }); // true
estatico.mq.query({ from: 'small', to: 'large' }); // true

if (estatico.mq.query({ from: 'small' })) {
    // ...
}

I haven't added any tests or jsdoc. Thoughts?

backflip commented 8 years ago

Slightly delayed: Awesome, thanks!!

Some cosmetic things commented in the code.

Something I'm wondering right now is whether we should stop exposing currentBreakpoint at this point since it doesn't really make too much sense any more. Thoughts?

Ping @stigmata86

d-simon commented 8 years ago

About the current breakpoint: It could still come in handy, when one simply wants to compare the current breakpoint. Although perhaps there is a better way to do this? For example:

estatico.mq.query({ current: 'large' });
backflip commented 8 years ago

We will have to check in some specific use cases, but this is already great for now. Thanks a lot!