Watching Blade files in Sage 9 Beta 2

OK! Progress.

Disabling HTML Injector as below, makes the page reload. However even for simple HTML changes nothing is injected.

If this is the intended behavior, great!

I might also note that I’m using SSL on localhost, the chrome bar is red, no warning are given on the console however I suspect this might be related. Makes sense?

It is related, thanks for pointing that out! Looks like injection is working as expected on non-HTTPS local dev setups

1 Like

I can’t seem to get this working either.

For me, HTML is injected into existing tags, but if you remove or add a tag to a Blade template, it breaks the injection and you have to refresh the page.

I’ve tried the changes from the master branch and also QWp6t’s pull request. – Neither have helped unfortunately.

Sorry, to clarify, I’m using a non-HTTPS local setup.

Ya this is starting to drive me a little crazy. This has been working on and off for me at this point. As of today, I have merged in all the changes from dev-master into my “base” theme and blade watching is working. I then merged my “base” theme into a forked theme I created, and it does not work. I have diff-ed the yarn.lock files and they are the same. I have diff-ed the assets/build directories and they are the same. Blew away node_modules, reinstalled, etc. All that is different is that my forked theme has different templates (using same base layout though), and has some leftover .php files that I am working on converting into blade templates.

I asked this before, but is there some way to get debug output from BrowserSync? I can see that my watch glob is being passed in (doing a console.log in the webpack.config.watch.js file), but I want to dump the actual file paths the glob is resolving.

I also should point out that disabling the HTML Injector does cause the page to reload when I save a file, so I’m assuming the watch detection is working. But I am still looking for some way of debugging and digging into this problem.

Well I was able to debug output from browsersync-webpack-plugin - not to be confused with browser-sync-webpack-plugin :expressionless:. I did this by adding NODE_DEBUG=browsersyncwebpackplugin to the start script, but it dumps out so much information I can’t really get anything meaningful out of it.

It kind of feels like this plugin (although obviously useful) is obfuscating the build process. Webpack is already pretty complex, without having to dig further into a plugin to debug things. I'm not trying to dish on QWp6t's hard work, but I feel like with all the build code we already have, what is another ~50-100 lines to accomplish this in a way where can actually see an interact with what is going on, rather than delegate to a plugin? All that aside, file changes are definitely being detected, I am getting debug info dumped out every time I save a blade file, just not HTML injection. I have ripped *everything* out of my templates directory trying to get to a simplest case, and I'm still coming up short.

EDIT: I AM AN IDIOT!

I forgot to disable hypercache on the site I was working on. Since the page is cached, bs-html-injector cannot detect any changes to the HTML. DUH.

1 Like

ahaha :slight_smile:

HTML injecting is working with the latest Sage changes for me on a (mostly) clean install. And I’m running https :thumbsup:

EDIT: Nevermind, doesn’t- work with HTTPS.

EDIT AGAIN: Nevermind my nevermind!! It works the second time I make an update and thereafter. I’m cool with that :slight_smile:

1 Like

I’m also having this issue and that is what fixed this issue for me. Running non-HTTPS and dev-master as of 14th of July. Hoping for a fix soon.

Hey all! New to Sage. I’m currently unable to get updates to .blade.php files to show up in BrowserSync. Sass updates are injected fine, though. The config.json file points to the correct directory (I’m using the default structure, so I haven’t changed anything anyway), so I’m totally lost as to what may be causing this.

Some info:

  • I created the project today from the composer create-project roots/sage your-theme-name dev-master command, so it’s all up to date.
  • I’m using the Windows Subsystem for Linux / Ubuntu Bash, which shouldn’t be a problem, but who knows.

Any help would be much appreciated! Thanks!

Okay, so adding "resources/views/**/*.blade.php" to the watch section in config.json made it mostly work, thank goodness. Sometimes it takes multiple saves for it to trigger, though.

1 Like

This is a 4 month old thread for beta 2 — which version of Sage 9 are you using?

Apologies, it’s the same (or a very similar) issue, so I figured I’d use the same thread. I’m using 9.0.0-beta.4.