feat: Adds browser-sync / hot reload

This commit is contained in:
2025-01-09 08:15:48 -05:00
parent e414afd95b
commit da5fec4a94
4 changed files with 49 additions and 22 deletions

View File

@@ -0,0 +1,17 @@
import Foundation
import Vapor
#if DEBUG
struct BrowserSyncHandler: LifecycleHandler {
func didBoot(_ application: Application) throws {
let process = Process()
process.executableURL = URL(filePath: "/bin/sh")
process.arguments = ["-c", "browser-sync reload"]
do {
try process.run()
} catch {
print("Could not auto-reload: \(error)")
}
}
}
#endif