NEVER just "copy and paste".
As Marco said
Optimize at compile/build-time, not runtime
Compress your assets using a lot of already available node scripts and build tools.
On server side, enable http2 and nginx caching.
On application level - compress/compile views as well depending on language. If it is PHP and you use template engine, you might generate a final vanilla PHP file itself like Laravel is doing out of the box. Same with any template engine you use in Node. You might also remove all tabs/spaces from HTML to make it even smaller.
You HAVE to know how everything works on lower level and you won't have any questions ever again.
Start from "History of the Internet", "How the Internet works?", OSI model, HTTP1, http server (nginx) configuration, then you just apply that knowledge to your current needs. You don't need to do anything at the beginning, only ADAPT to a situation. Start small, simple.