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

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

From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
Date: Wed, 18 Jan 2012 01:09:25 +0400
To: Tab Atkins Jr. <jackalmage@gmail.com>
Cc: www-style@w3.org
Message-Id: <61741326834565@web141.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>:
>>> š2012/1/17 Marat Tanalin | tanalin.com <mtanalin@yandex.ru>:
>>>> šš@imports could be allowed at least exactly at the end of stylesheet. Currently, to achieve same result, we are often forced to make order of including less logical. For example, we have main.css linked to HTML document, and override.css imported to main.css. We want that rules from override.css would override main.css rules with same specificity. For this purpose, rules from override.css have to appear in cascade _after_ rules from main.css. We could do this usable way:
>>>> ššš š<link rel="stylesheet" href="main.css" />
>>>> ššš šmain.css:
>>>> ššš š š š/* ...
>>>> ššš š š š š Some rules to be overridden.
>>>> ššš š š š š ... */
>>>> ššš š š š@import "override.css";
>>>> ššBut currently we are forced to link to override.css instead of main.css to HTML document, and import main.css at the beginning of override.css:
>>>> ššš š<link rel="stylesheet" href="override.css" />
>>>> ššš šoverride.css:
>>>> ššš š š š@import "main.css";
>>>> ššš š š š/* ...
>>>> ššš š š š š Some rules that override rules from main.css.
>>>> ššš š š š š ... */
>>>> ššAll that just decreases flexibility.
>>> šThe latter pattern is actually quite natural and easy to understand,
>>> šif you use different file names. šInstead of "main.css", call it
>>> š"template.css" or "defaults.css", and then instead of "override.css"
>>> šjust call it "main.css". šIt's then obvious and natural that you'd
>>> šdirectly reference the second file, and include the first file at its
>>> štop.
>> šThe thread is not about naming, but about flexibility.
> Naming is relevant here, because you are asserting that the pattern
> where "override.css" includes "main.css" is unnatural. šI pointed out
> that it's only unnatural because of the way the names you used are
> directing your assumptions. šWith different names, it's perfectly
> sensible.

Not naming is unnatural. What's unnatural here is that web-developers are forced to have exact stylesheet _nesting order_ dictated by purely theoretical harmful limitation.

>>> š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.
Received on Tuesday, 17 January 2012 21:09:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:10 UTC