mirror of
https://github.com/gohugoio/hugo.git
synced 2025-05-10 04:36:51 +03:00
Revert "Revert "Allow rendering static files to disk and dynamic to memory in server mode""
This reverts commit 64b7b7a897
.
This commit is contained in:
parent
9e360d3844
commit
0a56f2af4e
8 changed files with 69 additions and 25 deletions
|
@ -56,6 +56,9 @@ func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error {
|
|||
syncer.ChmodFilter = chmodFilter
|
||||
syncer.SrcFs = sourceFs.Fs
|
||||
syncer.DestFs = c.Fs.Destination
|
||||
if c.renderStaticToDisk {
|
||||
syncer.DestFs = c.Fs.DestinationStatic
|
||||
}
|
||||
|
||||
// prevent spamming the log on changes
|
||||
logger := helpers.NewDistinctErrorLogger()
|
||||
|
@ -101,7 +104,11 @@ func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error {
|
|||
toRemove := filepath.Join(publishDir, relPath)
|
||||
|
||||
logger.Println("File no longer exists in static dir, removing", toRemove)
|
||||
_ = c.Fs.Destination.RemoveAll(toRemove)
|
||||
if c.renderStaticToDisk {
|
||||
_ = c.Fs.DestinationStatic.RemoveAll(toRemove)
|
||||
} else {
|
||||
_ = c.Fs.Destination.RemoveAll(toRemove)
|
||||
}
|
||||
} else if err == nil {
|
||||
// If file still exists, sync it
|
||||
logger.Println("Syncing", relPath, "to", publishDir)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue