tombenner/nui

@media Queries to Target iPad / iPhone, Orientation, Auto-Layout Constraints

Closed this issue · 4 comments

CSS defines a pretty robust syntax for building responsive layouts with @media queries.

It would be exceedingly cool to be able to use them in this context to target device families and orientations. Perhaps something could be implemented with Auto-Layout Constraints to this effect.

Anyway, just wanted to put this out there as a feature request. Really psyched about the direction and momentum of this project. Well done, @tombenner!

(By the way, this was totally @dominic's idea originally. That guy is way smart.)

This would indeed be great! I'll try to take a look at implementing this sometime soon, but if anyone else wants to take a stab at it, go for it!

For this to take place, we'd probably want to set up a more proper parser for .nss files. Most lexical analyzer generators seem to have licenses that are ill-suited for the App Store, but @mattt has mentioned CoreParse, which looks very promising.

Maybe a very quick workaround can be implemented, such as automatically adding a ":iPad" nuiClass to all views when the app is running on an iPad. This way, one would just have to target ":iPad" elements for device specific styles.

CoreParse is very cool. I am using it to make a real style parser now, and I hope to have a pull request ready this week.

Major thanks to @phatmann for his implementation of this!