391

Product support

Get help in the plugin support forum.

Categories

Assets loaded from a web server are usually cached. This can cause an issue when a file is updated, but the browser cache prevents the user from seeing the changes. The way to solve this but still enable caching, which greatly increases site performance, is to append a hash to the end of an asset's file name. So that app.css becomes app-jid09j1230123.css, and that hash updates every time the file does.

There are tools like gulp-rev that does this automatically when building the project and outputs a manifest file to track the changes. This plugin reads that manifest file and returns the correct file revision. So that assets can still be worked with easily:

{{ "assets/css/app.css"|revision }} ... returns "assets/css/app-jid09j1230123.css"

For now the name of the manifest file can't be configured so adjust your build system to save the manifest file as "rev-manifest.json" in your theme root.

If the filter doesn't find a corresponding entry in the manifest it simply returns what the standard "theme" filter would have returned.

Manifest format

{
    "assets/css/app.css": "assets/css/app-963147aa74.css",
    "assets/css/app.js": "assets/js/app-9812u3982u.js"
}

Attribution

The plugin icon is made by Stanislav Levin and released under CC 3.0

  • Found the plugin useful on 19 Nov, 2019

    Hi, I think you should use Config::get('app.url') instead of Request::Root because it breaks https support - all assets links coming from you're plugin are http.

    Thanks!

  • Found the plugin useful on 31 Jan, 2019

    Handy plugin, works as expected, thanks :)

1.0.0

First version.

Sep 14, 2015