Re: Media Query Variables

On 2013-09-13, at 7:30 AM, Kornel Lesiński <kornel@geekhood.net> wrote:

> On 13 September 2013 12:05:13 David Newton <david@davidnewton.ca> wrote:
>> 
>> +1 for using <meta>. I think this would solve many of the issues being discussed. Does anyone know why these variables can't or should be in the <head>, before <style>?
> 
> 1. It makes a CSS feature use the HTML syntax.

I guess I meant a technical reason. To me, this is a more philosophical one. I agree that it's not ideal, but if it leads to a working solution, I think it's a reasonable compromise (especially since we're specifically talking about using Media Queries both in CSS and HTML here).

The related technical problem, though, is that they'd need to be declared on every HTML page, rather than once in the CSS files that use the vars. In a way, you're trading in one kind of repetition for another. I still think it's a better option, but I admit it's not ideal.


> 2. It closes door on using external file for breakpoints ever (unless you like having duplicate features). For example HTTP/2 Push could make external stylesheet available before HTML is parsed. That would be the holy grail - a single place for authors to manage breakpoints and compatibility with the preload scanner.

This seems like a good point, but I don't know enough about HTTP2 to know how important a consideration this is.


> 3. Not all applications need preload scanner. For example app.ft.com is a JS-based offline app. It needs responsive images, but not preload scanner. It would be shame if it had to use worse syntax and less maintainable solution to enable optimization it does not need.

That sounds like an edge case to me, and not enough reason to throw out an optimization that could benefit a huge number of other sites.

Received on Friday, 13 September 2013 12:15:32 UTC