How do I exclude .pdf files in HTML markup?

SLS needed

I have a conundrum I cannot seem to figure out!

I want to minify the HTML output of my site and have been doing it via some script in the functions file. It all works fine except in one irritating instance!

My site also serves PDF files (some static, some dynamically generated. The minification also tries to minify the PDFs and so they either don't come out at all or are very broken.

I'm wondering if there is a way to exclude URLs that end in .pdf from a function?