Skip to content
/ asset Public

The Nuxed Asset component manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files.

License

Notifications You must be signed in to change notification settings

nuxed/asset

Repository files navigation

Coding standards status Static analysis status Unit tests status Total Downloads Latest Stable Version License

Nuxed Asset

The Nuxed Asset component manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files.

Installation

This package can be installed with Composer.

$ composer require nuxed/asset

Example

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');
}

Security

For information on reporting security vulnerabilities in Nuxed, see SECURITY.md.


License

Nuxed is open-sourced software licensed under the MIT-licensed.

About

The Nuxed Asset component manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages