Hugo |> Dev Server Open Browser
Why hugo dev server can’t open browser tab automatically?
Modify hugo source code will definitely solve this issue.
Or we can use two simpler ways:
use some programe to run command
hugo serverandopen_browserin paralleluse simple command sleep
Here is the second way on macOS: (open command only works on macOS)
#!/bin/bash
LOCAL_URL=http://localhost:1313
run_after () {
duration=${1:-3}
sleep $duration
echo 'After '$duration
# change open command to proper one
open --new -a "Google Chrome" --args $LOCAL_URL
}
run_after 1 &
hugo serverReference:
