barrel/barrel-cli

brrl -w doesn't trigger browsersync updates with WordPress projects on Windows

Opened this issue · 0 comments

Problem: On a Windows/WordPress setup The brrl -w command doesn't trigger a browsersync update even though it compiles without error in response to file changes. Changes to js and css aren't reflected in the localhost site or proxied lando website as a result.

Background: lib/configure.js checks for '/wp-content/' in the webpack output path to form the public path for the api. On windows that path is backslashed in local configurations which breaks the path being fed to the webpack-dev-middleware initialization in lib/watcher.js. That in turn leads to the output files being compiled in memory at the wrong public path.

Solution: At the checkPublicPath() function in lib/configure.js use Node's path module to check for platform specific path separators then convert all backslashes to forward slashes when forming the public path.