Skip to content

Instantly share code, notes, and snippets.

@jdltechworks
Created November 2, 2018 12:25
Show Gist options
  • Save jdltechworks/3a8c922bd3dfc68711adc51b806bb65f to your computer and use it in GitHub Desktop.
Save jdltechworks/3a8c922bd3dfc68711adc51b806bb65f to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Support\HtmlString;
if (! function_exists('react_assets')) {
function react_assets($path, $manifestDirectory = '') {
$manifestPath = public_path('assets-manifest.json');
$files = array_reverse(json_decode(file_get_contents($manifestPath), true));
$regex = '/(map|html)/';
foreach ($files as $value) {
if(!preg_match($regex, $value)) {
print '<script src="'.$value.'"></script>';
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment