Ok this is not exactly a bug but it has to be fix and fast. Why on Earth 4.4.x was designed to load every single css file available no matter if the module is in use or not, for active modules? What is the login behind loading OPC css file(s) on site front page or products list page? What is the login behind loading Upsell products css file(s) on checkout pages? QT - PLEASE, an answer.
service_css.tpl loads on every single page and has the following code in it
Code:
{foreach from=$css_files item=files key=mname}
{foreach from=$files item=f}
{if ($f.browser eq $config.UA.browser and $f.version eq $config.UA.version) or ($f.browser eq $config.UA.browser and not $f.version) or (not $f.browser and not $f.version) or (not $f.browser)}
{if $f.suffix}
{load_defer file="modules/$mname/`$f.subpath``$smarty.config.CSSFilePrefix`.`$f.suffix`.css" type="css" css_inc_mode=$ie_ver}
{else}
{load_defer file="modules/$mname/`$f.subpath``$smarty.config.CSSFilePrefix`.css" type="css" css_inc_mode=$ie_ver}
{/if}
{/if}
{/foreach}
{/foreach}
This loads every css file in $css_files array regardless if it's needed or not. And $css_files array is populated by this code in init.php
Code:
if ($active_modules) {
foreach ($active_modules as $active_module => $tmp) {
$_module_dir = $xcart_dir . XC_DS . 'modules' . XC_DS . $active_module;
$_config_file = $_module_dir . XC_DS . 'config.php';
$_func_file = $_module_dir . XC_DS . 'func.php';
if (
file_exists($_config_file)
&& is_readable($_config_file)
) {
include $_config_file;
}
if (
file_exists($_func_file)
&& is_readable($_func_file)
) {
include $_func_file;
}
}
}
which calls config.php for every active module. config.php assigns all css files for its respective module to $css_files array.
Who was the bright mind behind all this? Did we really needed more bloated css? 4.4x. was suppose to be clean, css driven, up to the standards cart. Do you think Google likes to see 15+ different css files loading without even a single line from them being used? WOW. I have to revise the first line - this is a BUG, a huge one.
And by the way almost same applies to the js files loading with every page load. Lots of them and at least half of them are needed on specific pages only.
To somehow reduce that load make sure you turn off every module you don't need/use.