Obtaining webpage friendly HTML-code for a webpage

I’m trying to move a graph I created using the Plotly package on RStudio into HTML code to be used as a webpage. I’m able to get an html code if I save it as an HTML file, but it’s a massive HTML file. I’m looking to make it more webpage friendly to embed into a bigger webpage that has other charts. Does anyone have any idea how to do this?