PHPackages                             clubstudioltd/craft3-asset-rev - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. clubstudioltd/craft3-asset-rev

Abandoned → [clubstudioltd/craft-asset-rev](/?search=clubstudioltd%2Fcraft-asset-rev)Craft-plugin

clubstudioltd/craft3-asset-rev
==============================

A plugin to aid cache-busting in Craft 3

1.1.0(8y ago)71.9k3[2 issues](https://github.com/clubstudioltd/craft3-asset-rev/issues)MITPHP

Since Mar 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/clubstudioltd/craft3-asset-rev)[ Packagist](https://packagist.org/packages/clubstudioltd/craft3-asset-rev)[ RSS](/packages/clubstudioltd-craft3-asset-rev/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

[![image](./media/logo.png)](./media/logo.png)

Craft 3 Asset Rev (Cache Busting)
=================================

[](#craft-3-asset-rev-cache-busting)

**DEPRECATED:** Please  instead.

---

A Twig extension for Craft 3 that helps you cache-bust your assets by appending a query string or swapping out asset file names with their revved version, as they are defined in a JSON manifest file.

Manifest files would most likely be generated by Grunt/Gulp modules, such as [grunt-filerev-assets](https://github.com/richardbolt/grunt-filerev-assets) or [gulp-rev](https://github.com/sindresorhus/gulp-rev).

Why?
----

[](#why)

In order to speed up the load time of your pages, you can set a far-future expires header on your images, stylesheets and scripts. However, when you update those assets you'll need to update their file names to force the browser to download the updated version.

Using a manifest file is the recommended approach - you can read up on why using query strings isn't ideal [here](http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/).

Installation
------------

[](#installation)

Install via composer:

```
composer require clubstudioltd/craft3-asset-rev

```

or, download the plugin and copy the contents of `src` into a folder called `assetrev` in your `plugins` directory.

Be sure to activate the plugin from the Craft plugins settings page. Once activated, you may want to specify a custom path to your asset manifest file within the plugin configuration.

Configuration
-------------

[](#configuration)

The plugin comes with a `config.php` file that defines some sensible defaults.

If you want to set your own values you should create a `assetrev.php` file in your `config` directory. The contents of this file will get merged with the plugin defaults, so you only need to specify values for the settings you want to override.

### Manifest Path

[](#manifest-path)

`manifestPath` is where Craft should look for your manifest file. Non-absolute paths will be relative to the base path of your Craft installation (whatever `CRAFT_BASE_PATH` is set to).

### Assets Base Path

[](#assets-base-path)

`assetsBasePath` is the the base path to your assets. Again, this is relative to your craft base directory, unless you supply an absolute directory path.

### Asset Url Prefix

[](#asset-url-prefix)

`assetUrlPrefix` will be prepended to the output of `rev()`.

**Note:** You can use any environment variables that you may have set in your `.env` file using the `getenv()` function.

### Example assetrev.php Config File

[](#example-assetrevphp-config-file)

```
