The Nuxed Asset component manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files.
This package can be installed with Composer.
$ composer require nuxed/asset
use namespace Nuxed\Asset;
use namespace Nuxed\Asset\VersionStrategy;
<<__EntryPoint>>
async function main(): Awaitable<void> {
// For example, the manifest file might look like this:
// {
// "main.js": "main.abc123.js",
// "css/styles.css": "css/styles.555abc.css"
// }
$versionStrategy = new VersionStrategy\JsonManifestVersionStrategy('/path/to/manifest.json');
$cdns = vec[
'https://asset-s1.example.com/',
'https://asset-s2.example.com/',
];
$package = new Asset\UrlPackage($cdns, $versionStrategy);
// https://asset-s2.example.com/css/styles.555abc.css
echo await $package->getUrl('css/styles.css');
}
For information on reporting security vulnerabilities in Nuxed, see SECURITY.md.
Nuxed is open-sourced software licensed under the MIT-licensed.