How do I 'leverage browser caching' for Google fonts?

前端 未结 7 512
鱼传尺愫
鱼传尺愫 2020-12-12 23:42

I tested my site via Pingdom and got this:

\"enter

I searched but couldn\'t fi

7条回答
  •  被撕碎了的回忆
    2020-12-13 00:42

    What I got to work was adding PHP as a post-processor to my CSS files in my .htaccess file with the code (I'm using a custom .pcss file extension - just to make it separate from my simple CSS files):

    
    SetHandler application/x-httpd-php
    Header set Content-type "text/css"
    
    

    Then I used the following code in my CSS file to get and echo the content of the font URL I wanted.

    
    

提交回复
热议问题