My projects are structured like so:
/root src files
|_ /public
|_ /html
|_ index.html
|_ about.html
|_ contact.html
|_ /css
|_ /js
|_ index.php
Where all of the src files: html templates, Sass & raw JS scripts are in the root, and get published to the relevant folders in public.
I "build" everything in plain HTML first to test the functionality & flow, with links in html files just plain, relative filenames (e.g. <a href="about.html">
). I set my server to serve from the /public directory, and without BrowserSync, would browse to localhost/builds/ to test.
However, when using BrowserSync, setting --server
to public
and --index
to builds/index.html
loads the index at localhost:3000, but actually, all files need to be accessed through localhost:3000/builds.
This means that none of the links in the html files work, because they all just point to localhost:3000, so 404. I can't set BrowserSync to serve from /html because then the CSS & JS paths are incorrect.
Is there any way around this without moving the html files to the root of /public?