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

18.01.2012, 01:35, "Tab Atkins Jr." <jackalmage@gmail.com>:
> 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.)

I'm not talking about specific _method_ to link to CSS file from HTML document. I'm talking about linking to _one_ CSS file (be it via <link> or @import-inside-<style> -- it does not matter), and then controlling cascading purely on _CSS level_.

Both methods to include CSS files into HTML document are equivalent:

    <!-- We could use link element... -->
    <link rel="stylesheet" href="main.css" />

    <style>
        /* ...or single import inside style element.
           It does not matter what of them. */
        @import "main.css";
    </style>

> 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.

As I've already said, there are different situations: internet, intRAnet, local webpages opened from CD. Delay concern is generally applicable to former one only, but current limitation is applied forcedly and harmfully to all of them.

Received on Tuesday, 17 January 2012 21:58:01 UTC