opsdev/cache-breaker

Create link to static resources with cache-breaking segment based on md5 of the file

5.0.1 2022-03-24 12:31 UTC

This package is auto-updated.

Last update: 2024-12-10 07:45:59 UTC


README

This package provides a ViewHelper and a Fusion object that work like their original counterparts, but appending cache breaking segment based on the file's md5.

Installation

Require the package via composer:

composer require "opsdev/cache-breaker"

Usage

Use as a Fluid ViewHelper

{namespace opsdev=OpsDev\CacheBreaker\ViewHelpers}
<link rel="stylesheet" href="{opsdev:resource(path: 'path/to/your/file.css', package: 'Vendor.YourPackageName')}" />

Use as a Fusion object

stylesheets.index = T:Tag {
    tagName = 'link'
    attributes {
        href = OpsDev.CacheBreaker:ResourceUri {
            path = 'path/to/your/file.css'
            package = 'Vendor.YourPackageName'
        }
        type = 'text/css'
        rel = 'stylesheet'
    }
}

Credits

The development of this package is partially sponsored by CodeQ web factory, St Philaret Christian Orthodox Institute and internezzo ag.

Also the following persons have contributed to this package - thanks!

  • Dimitri Pisarev
  • Simon Schaufelberger
  • Guang Ha