Skip to content

Latest commit

 

History

History
21 lines (21 loc) · 585 Bytes

nova-hot-reloading.md

File metadata and controls

21 lines (21 loc) · 585 Bytes
<?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');
        });
    }
}