How to conditionally load a javascript or css?
What your looking to do is remove extra JS or CSS files, correct? AdvAgg can do this for you.
hook_advagg_js_pre_alter()
hook_advagg_css_pre_alter()
are the hooks you want to implement. Then inside of the hook you can use the arg() function to figure out what page your on.

$args = arg();
if (   isset($args[0]) &amp;&amp; $args[0] == 'node'
    &amp;&amp; isset($args[1]) &amp;&amp; is_numeric($args[1])
    &amp;&amp; !isset($args[2])
      ) {
  $node = node_load($args[1]);
  if (!empty($node) &amp;&amp; $node-&gt;type == 'page') {
    // Do awesome stuff to the JS/CSS array.
  }
}


See advagg_js_cdn_advagg_js_pre_alter() for an example on how the hook is used. Also be aware of drupal_is_front_page(); it might be useful.