According to official document, you only have to enable http static compression for your website.
To ensure IIS will compress FILE correctly, please ensure IIS static content feature has been installed(IIS->World wide web Services->Common HTTP Feature->Static Content).
Please go to web browser developer tool and check what's the content type is.

Secondly, please install IIS compression in IIS->World wide web service->Performance feature->Static Content Compression.
After installing IIS, please ensure IIS manager->site level->Compression->Static Content Compression has been checked.
Then Please access your website and check whether Content-Encoding has been displayed in response header.

If the response header is not displayed there, please check whether your content type has been set in IIS manager->configuration editor->system.webServer/httpCompression->staticTypes Collection.