Yarn browsersync is not reloading site when I save .blade.php or .php files

Hi all,

As per the title, running yarn build start but browser sync is not updating when I’m saving blade files in resources/views or php files in my app folder. Javascript file changes and style changes seem to work fine.

My dev site is on a non-https URL, I did find and old thread where that was a possible reason. Other than than that, I’m on Mac 10.13.2, Apache/2.4.28 (Unix) PHP/7.1.7. Not sure on Sage version but it’s very recent. I only started the project in the last week or two.

Any thoughts?
Kevin

Are these local to your host machine or are you using a VM?

Have you tried clearing out the Blade cache (uploads/cache/)?

Yes Ben, local to my host macbook.

I’ve cleared the cache and the problem persists however, I have noticed that it’s explicitly limited to the code that is within the logged in section. My site checks whether the user is logged in and includes partials accordingly, it’s these partials that are not triggering browser sync it seems. So this is the code on my page template:

@extends('layouts.app')
@php
  namespace Bbc;
@endphp

@section('content')
  @while(have_posts()) @php(the_post())
    @include('partials.page-header')
  @endwhile

  @if(is_user_logged_in())
    {{--Check that site mode is correct--}}
    @if(is_site_mode(['Nominations','Voting']))
      @include('partials.nominate', ['type' => 'trade-hero', 'thing' => 'trade hero'])
    @else
      Error: nominations are closed
    @endif
  @else
    Error: you need to be <a href="/login/">logged in</a> to nominate. Don't have an account, <a href="/register/">register here</a>.
  @endif
@endsection

So basically anything I add within the @if(is_user_logged_in()) section does not trigger browser sync it seems. Also noticed that if I make any updates just above that line, browser sync triggers but it falls through to

Error: you need to be <a href="/login/">logged in</a> to nominate. Don't have an account, <a href="/register/">register here</a>.

Seems a bit weird??
Kevin

Seems like you’re not logged in to the WP admin via your Browsersync session?

1 Like