Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Require runtime evaluation? #40

Open
eeeps opened this issue Jun 9, 2017 · 3 comments
Open

Require runtime evaluation? #40

eeeps opened this issue Jun 9, 2017 · 3 comments

Comments

@eeeps
Copy link
Collaborator

eeeps commented Jun 9, 2017

In a lot of cases, container queries are a developer-convinence feature.

In other words — you could write Media Queries; there's a deterministic relationship between viewport size and component state — but Container Queries would be much more compact, DRY, understandable, explainable, & maintainable.

I sort of hesitate to suggest it, but if the inherent layout performance penalties involved in evaluating CQs are too heavy at runtime, perhaps they could be better implemented in-front of some kind of pre-processing tool? Which would convert all of your tidy CQs into MQ spaghetti, for deployment.

@tabatkins
Copy link
Contributor

Doing so requires you feeding layout information to the system in some way.

@eeeps
Copy link
Collaborator Author

eeeps commented Jun 9, 2017

And I guess while the system has access to your CSS, it doesn't have access to the browsing environment (e.g., user styles). Hm.

Note that this is also true for most of the media-queries-for-components that people are writing everywhere all of the time right now. But the "system" there is the media query author, who's assuming things.

@ausi
Copy link
Collaborator

ausi commented Jun 10, 2017

I thought of that in the past and I think it’s possible to write a PostCSS plugin that can achieve that, but the features would be way less powerful than what the JS runtimes offer.

I just posted a draft of how I think this could work: https://gist.github.com/ausi/6f74afbd75127151addfe75f81cfe5da

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants