[TYPO3-german] includeCSS order

Wenzel Dirk listen at arkadias.de
Sat Dec 24 10:47:29 CET 2011


Hi,
recently I discovered an unexpected behaviour:
Including CSS files via includeCSS they appear in _reverse_ order in page header:

For instance:

page.includeCSS {
	file1 = path/to/file1.css
	file2 = path/to/file2.css
	file3 = path/to/file3.css
}

leads to this order:

<head>
	[...]
	<link href="path/to/file3.css" media="all" type="text/css" rel="stylesheet">
	<link href="path/to/file2.css" media="all" type="text/css" rel="stylesheet">
	<link href="path/to/file1.css" media="all" type="text/css" rel="stylesheet">
	[...]
</head>

A reverse sorting produces the intended result:
page.includeCSS {
	file3 = path/to/file3.css
	file2 = path/to/file2.css
	file1 = path/to/file1.css
}

results in:
<head>
	[...]
	<link href="path/to/file1.css" media="all" type="text/css" rel="stylesheet">
	<link href="path/to/file2.css" media="all" type="text/css" rel="stylesheet">
	<link href="path/to/file3.css" media="all" type="text/css" rel="stylesheet">
	[...]
</head>

Searching the web I got inconsistent statements. Some posts claim the order of inclusion to be controllable by numbering. But an earlier post by Dmitri Dulepov at this list (June 2008: http://lists.typo3.org/pipermail/typo3-english/2008-June/050561.html) says:

> The inclusion order is not defined if you use includeJS/includeCSS.

>> How can I control the order of includes?
> 
> Use page.headerData instead.

And here are my questions:
1. Is Dmitris statement still valid for current versions (4.5 or 4.6)?
2. Why is the order undefined? 

Since the order of CSS and JS does matter for the page rendering one should be able to control it. To put it bluntly: An instruction which produces an undefined order seems pretty useless to me. 

Kind regards and Merry Christmas
Dirk



More information about the TYPO3-german mailing list