By elkin_taharon on
Hi guys,
i'm having troubles with some css and js that came from modules that i'm not even using in front page, i think that the best thing to do for performance and for my custom behaviors is to avoid the charge of those in front-page.
I already to make an overwrite for the ccs in the template.tpl but is not working at all.
function phptemplate_preprocess_page(&$vars) {
if( $vars['is_front'] ){
$vars['css']["all"]["module"]["sites/all/modules/thickbox/thickbox.css"]= false;
$vars['css']["all"]["module"]["sites/all/modules/thickbox/thickbox_ie.css"]= false;
$vars['styles'] = str_replace( '<link type="text/css" rel="stylesheet" media="all" href="/v2/sites/all/modules/thickbox/thickbox_ie.css?B" />', " ", $vars['styles']);
$vars['styles'] = str_replace( '<link type="text/css" rel="stylesheet" media="all" href="/v2/sites/all/modules/thickbox/thickbox.css?B" />', " ", $vars['styles']);
}
...
...
Any help ?
Thanks in advance,
Elkin.
Comments
I haven't tested this but you
I haven't tested this but you may want to try unsetting the array instead of making if false;
unset($vars['css']["all"]["module"]["sites/all/modules/thickbox/thickbox.css"]);
--
Rachel J.
Hi primerg, I just tested
Hi primerg,
I just tested the unset but the css still there, obviously i did clear the site cache.
Thx.
I tried your code - the
I tried your code - the str_replace - and it worked for me. Did you add that in your template.php?
--
Rachel J.
Why not just have Drupal
Why not just have Drupal Optimize the CSS and Javascript into 2 pages?
Also I really doubt you will see any real improvement in performance.
Do you need the CSS for the rest of the site? I had read somewhere if you include the the name of the stylesheet in your themes .info file when the theme looks and it does not exist it will not be included.
HI tommyent, The main idea of
HI tommyent,
The main idea of this is not load css or js that i'm not using on front page, i have 45.000 page views at day is not so much traffic and the i'm sure that i won't see a boost in the performance, but the client insist in this matter.
Thx.