W3C home > Mailing lists > Public > www-style@w3.org > January 2012

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 17 Jan 2012 13:35:46 -0800
Message-ID: <CAAWBYDAhk+b_ywfjS1hCGS6VT+1um61=Qf3BpoLFfYWa-D5wxg@mail.gmail.com>
To: "Marat Tanalin | tanalin.com" <mtanalin@yandex.ru>
Cc: www-style@w3.org
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:48 GMT