Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <?php
  2.  
  3. // Place AssetsHelper.php file to the directory you wish, favourably inside app/Helpers.
  4. // Then reference it from the composer.json.
  5.  
  6. if (!function_exists('public_path')) {
  7.  
  8. /**
  9. * Get the path to the public folder.
  10. *
  11. * @param string $path
  12. *
  13. * @return string
  14. */
  15. function public_path($path = '')
  16. {
  17. return __DIR__ . '/../../public' . ($path ? DIRECTORY_SEPARATOR . $path : $path);
  18. }
  19. }
  20.  
  21. if (!function_exists('elixir')) {
  22.  
  23. /**
  24. * Get the path to a versioned Elixir file.
  25. *
  26. * @param string $file
  27. * @param string $buildDirectory
  28. *
  29. * @return string
  30. *
  31. * @throws \InvalidArgumentException
  32. */
  33. function elixir($file, $buildDirectory = 'build')
  34. {
  35. static $manifest;
  36. static $manifestPath;
  37.  
  38. if (is_null($manifest) || $manifestPath !== $buildDirectory) {
  39. $manifest = json_decode(file_get_contents(public_path($buildDirectory . '/rev-manifest.json')), true);
  40. $manifestPath = $buildDirectory;
  41. }
  42.  
  43. if (isset($manifest[$file])) {
  44. return '/' . $buildDirectory . '/' . $manifest[$file];
  45. }
  46.  
  47. throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement