.php files not triggering injection/reload

I’ve setup my environment using fresh installs of the latest versions of Trellis, Bedrock, and Sage. When running yarn start, CSS changes are detected without a problem and updated within the browser but any change to a .php file is ignored. Manually reloading the browser shows my changes.

After viewing older topics on the subject, I’ve tried to make sure my config.json is correct:

{
  "entry": {
    "main": [
      "./scripts/main.js",
      "./styles/main.scss"
    ],
    "customizer": [
      "./scripts/customizer.js"
    ]
  },
  "publicPath": "/app/themes/mytheme",
  "devUrl": "http://mytheme.test",
  "proxyUrl": "http://localhost:3000",
  "cacheBusting": "[name]_[hash:8]",
  "watch": [
    "app/**/*.php",
    "config/**/*.php",
    "resources/views/**/*.php"
  ]
}

I’m a bit stumped as to why the CSS refreshing works great but .php files don’t trigger a reload/injection.

It’s only watching PHP files in these directories:

"watch": [
    "app/**/*.php",
    "config/**/*.php",
    "resources/views/**/*.php"
  ]

You can add more directories if you’re editing PHP files elsewhere. File watching can also be a little variable based on the OS. What is your development environment?

Thanks for the reply!

I’m on macOS Mojave and I’m getting the issue when trying to edit PHP files within those directories.

Any more info on your local dev setup? (Vagrant box? Docker? Valet?)

I’m using Vagrant with Trellis (and Bedrock/Sage if helpful). My dev environment setup essentially followed the documentation verbatim.

Unfortunately bs-html-injector is buggy and abandoned, and the developer experience is not consistent for everyone. Some people don’t have issues, other people do :confused: We’re not using this package anymore in the next version of Sage.

You can remove it from your theme dependencies and the build process will still work… just without injection :frowning:

If your local dev has HTTPS enabled, you could also try disabling SSL and seeing if injection works.

2 Likes

Ah I see, that’s unfortunate about the package! Thanks for taking the time to look into it. I’m eagerly awaiting the next version of Sage :slight_smile:

This topic was automatically closed after 42 days. New replies are no longer allowed.