Cachet/app/helpers.php

29 lines
589 B
PHP
Raw Normal View History

<?php
if ( ! function_exists('elixir'))
{
2014-12-01 08:42:11 +00:00
/**
* Get the path to a versioned Elixir file.
*
* @param string $file
* @return string
*/
function elixir($file)
{
static $manifest = null;
2014-12-01 08:42:11 +00:00
if (is_null($manifest))
{
$manifest = json_decode(file_get_contents(public_path().'/build/rev-manifest.json'), true);
}
2014-12-01 08:42:11 +00:00
if (isset($manifest[$file]))
{
return '/build/'.$manifest[$file];
}
2014-12-01 08:42:11 +00:00
throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
}
}