@ Susan
This is not actually an easy problem to solve. I had code to do this once and removed it because extensions for Connections such as the Widget Pack utilize the same CSS files and the only way to detect everywhere Connections can be used would to be somehow to preprocess the entire page looking for all instances and it still not would be reliable. In addition you would effectively be loading the page twice, doubling load time which is not something you really want to do because Google uses page load time as a metric when it weighs pages in its search results.
Now, if you are not using any extension and only the shortcode in the page/post content area, you could hook into the the WordPress the_posts filter and use the has_shortcode() function to check for the connections shortcode and then dequeue the Connections qscripts if it is not found.
Honestly, you are much better off using a plugin like Autoptimize or JCH Optimize. My personal favorite is WP Rocket.
Alternative, you could use the Plugin Organizer plugin to setup which plugins load on which pages. I haved a few users, not related to using this plugin, but it seemed to be more trouble than it’s worth but that is just my opinion.
Hope that helps!
