[TYPO3-english] includeCSS order

Wenzel Dirk listen at arkadias.de
Sat Dec 24 14:19:22 CET 2011


[update]

A hint from Markus Kobligk at the german mailing list seems to point to the right direction:
The behaviour described below occurs when the extension scriptmerger is installed and some conditions are met.

A quick test produces the following results:
case 1 - scriptmerger is not installed
- files are included as ordered in typoscript

case 2 - scriptmerger is installed but all options are disabled (minify.enable =0, compress.enable=0, merge.enable=0)
- files are included in reverse order

case 3 - scriptmerger is installed 
a) only option 'merge' active (minify.enable =0, compress.enable=0, merge.enable=1) OR
b) options 'merge' AND 'compress' active (minify.enable =0, compress.enable=1, merge.enable=1) OR
c) options 'merge' AND 'compress' AND 'minify' active (minify.enable =1, compress.enable=1, merge.enable=1)
- CSS files from extensions are included first (in resulting file [...].merged.css)
- thereafter own files are included

(I did'n test other cases yet)

for the sake of completeness some additional information:
- typo3 version 4.5.7
- scriptmerger version 3.2.4
- scriptmerger also used for JS and all options active (minify, compress, merge)
- one JS-file moved to top via fileX.forceOnTop = 1 

I'm still curious for an answer to my previous questions
> 1. Is Dmitrys (sorry for misspelling) statement still valid for current versions (4.5 or 4.6)?
> 2. Why is the order undefined? 


Kind regards
Dirk

Am 24.12.2011 um 10:47 schrieb Wenzel Dirk:
> 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
> 
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english



More information about the TYPO3-english mailing list