• Resolved triptor

    (@triptor)


    tldr; How to modify bwp_minify function to output filename based on file’s date modified (forcing redownload).

    I want the bwp_minify function to output a unique filename based on that file’s date modified, so every update to the file forces a reminify and forces the browser to redownload it, making my life easier for updating users’ caches (and helping with my testing).

    This could be done by simply adding the unix timestamp to the end of the filename.

    Obvious problem is that a lot of changes to that file will create a lot of cached versions (could be subjugated by clearing the cache directory every X days).

    I would make this change myself (simply appending ‘filemtime($src)’ to the filename, but I’m not certain if I should be editing the ‘get_minify_src’ function or the ‘process_media_source’ function. (or if I need to edit the htaccess)

    Your help would be much appreciated and this seems like it would make a great optional variable when calling the bwp_minify function.

    Thanks.

    https://www.ads-software.com/plugins/bwp-minify/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Khang Minh

    (@oddoneout)

    How about using the cache buster setting?

    Thread Starter triptor

    (@triptor)

    I’m embarassed.

    Somehow in my repeat searching through the settings I completely missed that option, it’s exactly what I need.

    Thank you.

    Plugin Author Khang Minh

    (@oddoneout)

    Perhaps the way I’m presenting the settings are not clear enough?

    Either way, I’m planning to add this feature https://github.com/OddOneOut/bwp-minify/issues/38 to 1.4.0, which should obsolete the cache buster feature for friendly minify urls ??

    Plugin Author Khang Minh

    (@oddoneout)

    By the way, you are using bwp_minify() but that function only supports minifying one file at a time. Would it be beneficial to you if it supports combining files as well?

    Thread Starter triptor

    (@triptor)

    For my purposes I only need the one file, I could see many use cases where I and/or others would need multiple files minified at once though, is that already a feature?

    For the cache buster, it is what I wanted but not in the exact way. Instead of adding query params (?ver=xxxxx) to the url, is it possible to just add it to the minified file string?

    So from:
    minify-b1–b89898e14f303e4dadce6a76f3772cf7.css?ver=1439911722

    To:
    minify-b1–b89898e14f303e4dadce6a76f3772cf7-ver-1439911722.css

    The problem with using query params is that some proxies will not properly cache those files, which can lead to a lot of unwanted requests.

    Plugin Author Khang Minh

    (@oddoneout)

    This https://github.com/OddOneOut/bwp-minify/issues/38 will be the exact thing that you want, and will be implemented in 1.4.0.

    Thread Starter triptor

    (@triptor)

    Thanks Khang, your quick responses and support is amazing.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to have filename (using bwp_minify) be created from date modified?’ is closed to new replies.