I thought this would have been handled automatically by wp_enqueue_script() and wp_enqueue_style().