Skip to content

Instantly share code, notes, and snippets.

@niladam
Forked from bayareawebpro/nova-hot-reloading.php
Created December 13, 2018 21:12
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 niladam/81d05c01999ce6bff2709d867c21e0d1 to your computer and use it in GitHub Desktop.
Save niladam/81d05c01999ce6bff2709d867c21e0d1 to your computer and use it in GitHub Desktop.
<?php
class FieldServiceProvider extends ServiceProvider{
/**
* Bootstrap the field services.
* @return void
*/
public function boot()
{
Nova::serving(function (ServingNova $event) {
$files = app('files');
if($files->exists(__DIR__.'/../dist/hot')){
Nova::remoteScript('http://localhost:8080/js/field.js');
}else{
Nova::script('myField', __DIR__.'/../dist/js/field.js');
}
Nova::style('myField', __DIR__.'/../dist/css/field.css');
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment