Having taken over a somewhat shabby Typo3 project recently (I prefer using the term “challenge” here), digging through the many TypoScript files revealed something which is probably very common in many Typo3 setups:
[browser = msie] page.includeCSS.file22 = fileadmin/templates/css/ie.css [browser = msie] AND [version = 7] page.includeCSS.file23 = fileadmin/templates/css/ie7.css [GLOBAL]
Why is that a problem? Well, when it comes to caching, Typo3 starts building up Cache entries for every possible condition. So from the above example, we will get 3 cache entries:
- Internet Explorer 7
- Other Internet Explorers
- All other browsers except Internet Explorer
Of course this blows up the database, but space wasn’t the main problem in our case – it was the time it took to rebuild the cache after clearing it. This Typo3 installation serves thousands of pages, and they are crawled regularly to build up the cache, so we really don’t want to waste any time.
So what do we do? First and obvious step, drop IE 7 support! Ahhh, that feels so right…. Ok. Now the remaining, really few IE hacks in the ie.css will be included by using good old Conditional comments:
page.headerData.123 = TEXT page.headerData.123.value ( <!--[if IE]> <script type="text/css" src="fileadmin/templates/css/ie.css"></script> <![endif]--> )
The additional load for IE users is minimal, and we got rid of quite some cache entries and saved a good amount of computational power.