summaryrefslogtreecommitdiffstats
path: root/commands/static_syncer.go
diff options
context:
space:
mode:
authorSatowTakeshi <doublequotation@gmail.com>2021-04-18 16:13:00 +0900
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-08 19:27:54 +0100
commit7d8011ed63d587b87a7c182748914fe146590093 (patch)
treecde6c99c5a439e64e0a2e5c9d2f0d4b03eba6577 /commands/static_syncer.go
parentb9a1be2f9961516a674ff15a409433606e70ac7b (diff)
Allow rendering static files to disk and dynamic to memory in server mode
Updates #9625
Diffstat (limited to 'commands/static_syncer.go')
-rw-r--r--commands/static_syncer.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/commands/static_syncer.go b/commands/static_syncer.go
index 5569d4de6..2eb2b6662 100644
--- a/commands/static_syncer.go
+++ b/commands/static_syncer.go
@@ -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)