Support » Plugin: Self-Hosted Google Fonts » Include Option for CDN

  • Daniel

    (@skylayer)


    Hey there!

    First of all, I thank you so much for creating this. This solved a lot of issues for me. Great work.

    I was wondering whether you could somehow include an option to rewrite the URL which gets put into the CSS file. I am using KeyCDN, the sgf-css file gets loaded from the CDN but the URLs inside the CSS file still point to my origin.

    I saw someone else has the same issue.

    Any ideas?

    Sincerely,
    Daniel

    • This topic was modified 11 months ago by  Daniel.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author asadkn

    (@asadkn)

    Hi Daniel,

    I am quite swamped with other work right now but I will take a look at whenever I get a chance. Can you name the plugin you’re using for CDN?

    I am using wp_upload_dir() in the plugin with baseurl key so not sure why the CDN plugin isn’t playing well – it should as it did with s3 offload plugin. Make sure the CDN plugin was activated before SGF and clear SGF cache from Settings > Self-Hosted Google fonts > Clear cache – and the cache plugin too.

    Hi, I’m also having the same issue.

    Thank you for a great plugin, @asadkn !

    It would be great to have a setting for the domain, but in the meantime it’s possible to edit /inc/process.php like this:

    /**
     * Upload URL for fonts and CSS files
     */
    public function get_upload_url($file = '')
    {
    	$upload = wp_upload_dir(null, false);
    	$url    = 'https://cdn.example.com.com/wp-content/uploads/sgf-css/';
    • This reply was modified 8 months, 2 weeks ago by  kolyasapphire.

    And the second part in process-css.php

    Add after:

    /**
     * Get a local file by the provided URL - CSS files only
     * 
     * @see wp_normalize_path()
     */
    public function get_css_file_path($url)
    {

    This:

    $url = str_replace('example.com','cdn.example.com',$url);

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Include Option for CDN’ is closed to new replies.