Unfortunately, no way.
WP Super Cache can not compress static files, such as .css, .js, .ttf and .otf. So, if you use any existing compression technique to compress CSS and JS files, you may use the same compression technique to compress both .ttf and .otf files too. How are you compressing CSS and JS files?
How are you compressing CSS and JS files?
Oh, wait… I see the answer… I’m using Divi, and have the Minify and Combine JS & CSS options set. D’oh!
Any suggestions of other ways to compress PNG/TTF/OTF/etc. resources?
Many thanks!
This came on top of the search result… https://kinsta.com/knowledgebase/enable-gzip-compression/ . Please scroll down to “Enable GZIP on Apache” (it’s a very long article).
Thank you for getting back to me. I also searched around, and found a similar set of directives at https://www.collectiveray.com/wp/tips/enable-wordpress-gzip-compression.
Here’s how these directives work:
- The
AddType x-font/otf .otf line explicitly declares a file with “.otf” suffix to be of type “x-font/otf”
- The
AddOutputFilterByType DEFLATE x-font/otf line specifically causes that file type to be compressed.
- Note that
application/x-font and application/x-font-otf are totally different file types from x-font/otf – you have to make sure they match an AddType line.
- Even though Divi (page builder) is minifying and combining CSS and JS files on my site, it is important to have the corresponding AddOutputFilterByType for those file types (text/css and application/javascript) so they also get compressed.
- I didn’t check to see that all the other AddOutputFilterByType lines were correct – only that .otf, .ttf, and .png would be compressed.
<IfModule mod_deflate.c>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE image/png
AddOutputFilterByType DEFLATE x-font/ttf
AddOutputFilterByType DEFLATE x-font/otf
AddType x-font/otf .otf
AddType x-font/ttf .ttf
AddType x-font/eot .eot
AddType x-font/woff .woff
AddType image/x-icon .ico
AddType image/png .png
</IfModule>