• Resolved zigpress

    (@zigpress)


    I’ve now installed this on a site for which speed is vital and am impressed with the GTMetrix waterfall for the files loaded from the CDN.

    Question: I can see that, as well as images, CSS and JS files are also loaded via the CDN. What happens if I make a change to one of those files? How long before it expires at the CDN?

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

    (@shift8)

    Great question!

    I believe static assets are cached for 10 minutes before asking for a new copy. I’d have to double check that but we also send a header asking the browser to locally cache the file for 1 day.

    Best practice when dealing with CDNs is to simply increment the version query string for your static CSS/JS file.

    If you are are enqueuing your script in your theme’s functions file, you can read this page to learn how to add a version query string to your file : https://developer.ww.wp.xz.cn/reference/functions/wp_enqueue_style/ (there is a $ver variable you can set).

    If the CDN sees the query string requested for the file change, it will consider it a new file and fetch it like its a new filename. If for some reason this doesnt happen, let us know!

    Thread Starter zigpress

    (@zigpress)

    Thanks very much for the info. I’ll incorporate my custom theme’s version number into its stylesheet and script tags.

    Can I make a feature suggestion for the plugin? You could have 3 checkboxes on the settings page: include images, include stylesheets, include scripts (all checked by default). That would determine what is fetched via the CDN and what is left alone to be fetched from the website. It would increase flexibility and versatility.

    Plugin Author shift8

    (@shift8)

    Thanks for the suggestion!

    We are also considering an option to manually set the cache control headers to specify cache expiration times. All of these options would definitely be helpful.

    Since this is a free service , we have to grow slowly and steadily in proportion to demand increasing.

    Thanks again for the suggestion.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Question about JS and CSS’ is closed to new replies.