How to remove unnecessary JS,CSS, etc from any theme?

I am using OceanWP theme for my website and i would like to optimise the performance of the website. I would like to remove the unnecessary js, css, etc from the theme and keep the resources only which required for my website. For example, while reviewing the functions.php i found that there’s a resources related to WooCommerce in the theme which is not required.
01. How to identify the unnecessary resources with or without using plugins?
02. How to remove it safely from the theme?
03. It shouldn’t add the removed resources again while updating theme.

I would like the wordpress community to share their ideas.


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer