W3cubDocs

/Symfony 4.1

JsonManifestVersionStrategy

class JsonManifestVersionStrategy implements VersionStrategyInterface

Reads the versioned path of an asset from a JSON manifest file.

For example, the manifest file might look like this: { "main.js": "main.abc123.js", "css/styles.css": "css/styles.555abc.css" }

You could then ask for the version of "main.js" or "css/styles.css".

Methods

__construct(string $manifestPath)
string getVersion(string $path)

With a manifest, we don't really know or care about what the version is. Instead, this returns the path to the versioned file.

string applyVersion(string $path)

Applies version to the supplied path.

Details

__construct(string $manifestPath)

Parameters

string $manifestPath Absolute path to the manifest file

string getVersion(string $path)

With a manifest, we don't really know or care about what the version is. Instead, this returns the path to the versioned file.

Parameters

string $path A path

Return Value

string The version string

string applyVersion(string $path)

Applies version to the supplied path.

Parameters

string $path A path

Return Value

string The versionized path