Commit 96ed638c authored by Aral Balkan's avatar Aral Balkan
Browse files

Addition of generated folder now causes server to restart

parent ed227df7
......@@ -1200,11 +1200,15 @@ class Site {
const roots = []
//
// Serve any generated static content (e.g., Hugo output) that might exist.
const generatedStaticFilesDirectory = path.join(this.pathToServe, '.generated')
if (fs.existsSync(generatedStaticFilesDirectory)) {
//
this.generatedStaticFilesDirectory = path.join(this.pathToServe, '.generated')
this.generatedContentExists = fs.existsSync(this.generatedStaticFilesDirectory)
if (this.generatedContentExists) {
this.log(` 🎠 ❨site.js❩ Serving generated static files.`)
roots.push(generatedStaticFilesDirectory)
roots.push(this.generatedStaticFilesDirectory)
}
// Add the regular static web root.
......@@ -1319,6 +1323,13 @@ class Site {
this.log(` 🐁 ❨site.js❩ Wildcard route change: ${clr(`${this.prettyFileWatcherEvent(event)}`, 'green')} (${clr(file, 'cyan')}).`)
this.log('\n 🐁 ❨site.js❩ Requesting restart…\n')
await this.restartServer()
} else if (file.includes('/.generated') && !this.generatedContentExists && fs.existsSync(this.generatedStaticFilesDirectory)) {
//
// Generated folder has been added.
//
this.log(` 🐁 ❨site.js❩ Generated folder has been added: ${clr(`${this.prettyFileWatcherEvent(event)}`, 'green')} (${clr(file, 'cyan')}).`)
this.log('\n 🐁 ❨site.js❩ Requesting restart…\n')
await this.restartServer()
}
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment