nuxed/asset

Nuxed Asset

Maintainers

Details

github.com/nuxed/asset

Source

Issues

Installs: 29

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Language:Hack

v2.0.0 2020-11-22 02:02 UTC

This package is auto-updated.

Last update: 2024-10-22 10:43:55 UTC


README

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.