Created
October 26, 2015 17:14
-
-
Save jstewsy/a74f0035681e8cd28140 to your computer and use it in GitHub Desktop.
elixir helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | |
} | |
} |
ghost
commented
Oct 26, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment