Skip to content

Instantly share code, notes, and snippets.

@jstewsy
Created October 26, 2015 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstewsy/a74f0035681e8cd28140 to your computer and use it in GitHub Desktop.
Save jstewsy/a74f0035681e8cd28140 to your computer and use it in GitHub Desktop.
elixir helper
if (! function_exists('elixir')) {
/**
* Get the path to a versioned Elixir file.
*
* @param string $file
* @return string
*
* @throws \InvalidArgumentException
*/
function elixir($file)
{
static $manifest = null;
if (is_null($manifest)) {
$manifest = json_decode(file_get_contents(public_path('build/rev-manifest.json')), true);
}
if (isset($manifest[$file])) {
return '/build/'.$manifest[$file];
}
throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
}
}
Copy link

ghost commented Oct 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment