Re: @import -- allow at any place in stylesheet.

2012/1/17 Marat Tanalin | tanalin.com <mtanalin@yandex.ru>:
> 18.01.2012, 01:01, "Tab Atkins Jr." <jackalmage@gmail.com>:
>> 2012/1/17 Marat Tanalin | tanalin.com <mtanalin@yandex.ru>:
>>>  17.01.2012, 22:49, "Tab Atkins Jr." <jackalmage@gmail.com>:
>>>>  Alternately, this works today:
>>>>
>>>>  <style>
>>>>  @import "main.css";
>>>>  @import "override.css";
>>>>  </style>
>>>
>>>  We can't, we are _forced_ to.
>>>
>>>  It would be nice improvement of core CSS syntax if web-developers would get able to link to one CSS file in HTML document, and then to flexibly control cascading on pure CSS level.
>>
>> What is wrong with the fragment I provided above?
>
> It's not wrong, it's different from what I'm talking about. I'm not going to repeat myself though.

You are *specifically* asking for the ability to use a <link> element.
 That's remarkably specific.  I offered an example that accomplishes
the same thing using the <style> element.  What is wrong with that
example?  Why are you requiring that a solution specifically use the
<link> element?

(Note that my example is equivalent to just putting in two <link>
elements, anyway.)

Stepping outside this problem, you shouldn't really be using @import
in your stylesheets anyway.  It's bad for performance, since it makes
your stylesheets download one-by-one instead of in parallel.  Making
@import more powerful might encourage more use of this, which I'd
personally prefer to avoid.  It's better to either link in multiple
stylesheets via multiple <link> elements (so the browser can start
downloading all of them at once), or use a preprocessor to munge the
sheets together into a single file so you can pull them all down with
a single request.

~TJ

Received on Tuesday, 17 January 2012 21:36:34 UTC