siteparts/plates-asset

Generate cache busted web assets URLs in Plates

Installs: 25

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/siteparts/plates-asset

v1.0.0 2023-11-08 11:40 UTC

This package is auto-updated.

Last update: 2025-10-08 15:47:08 UTC


README

Generate cache busted web assets URLs in Plates.

plates-asset uses asset to generate cache busted assets URLs in Plates.

Installation

Via Composer:

$ composer require siteparts/plates-asset

Usage

Setup AssetHelper according to the asset instructions and enable the extension:

use SiteParts\Templating\Plates\Extension\Asset\AssetExtension;

// $engine is instance of League\Plates\Engine
// $assetHelper is instance of SiteParts\Asset\AssetHelper
$engine->loadExtension(new AssetExtension($assetHelper));

Use assetUrl in your template:

<img src="<?= $this->assetUrl("img/image.png") ?>" alt="...">

For use with a PSR-11 container, you can also use the ConfigProvider supplied.