use hardlink instead of full copy for files other than Markdown or HTML

This commit is contained in:
gutmet 2019-07-27 22:42:50 +02:00
parent 561692a8ba
commit 27cc696d88
4 changed files with 5 additions and 3 deletions

View File

@ -27,7 +27,7 @@ func clean() {
}
func stage1() {
goutil.Copy("stage0", "stage1")
goutil.CopyDirsLinkFiles("stage0", "stage1")
mdfiles := goutil.RecListFilesExt("stage1", ".md")
htmlfrags := goutil.RecListFilesExt("stage1", ".html")
splitter.SplitAll(append(mdfiles, htmlfrags...))
@ -43,7 +43,7 @@ func blogs() []string {
}
func stage2() {
goutil.Copy("stage1", "stage2")
goutil.CopyDirsLinkFiles("stage1", "stage2")
site.Generate()
for _, blogdir := range blogs() {
blog.Generate(blogdir)

2
go.mod
View File

@ -2,7 +2,7 @@ module git.gutmet.org/wombat.git
require (
git.gutmet.org/finstr.git v0.0.0-20190103161247-f1cd2d363522
git.gutmet.org/goutil.git v0.0.0-20190219232751-e251b8616e36
git.gutmet.org/goutil.git v0.0.0-20190727202444-1a369915ff2f
git.gutmet.org/simpleserver.git v0.0.0-20181209151100-b298451c1f40
github.com/russross/blackfriday/v2 v2.0.1
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95 // indirect

View File

@ -120,6 +120,7 @@ func completePage(path string, t *template.Template, style string) {
fmt.Println(err)
}
destination := strings.Replace(path, "stage1", "stage2", 1)
os.Remove(destination) // remove hardlink before writing
goutil.WriteFile(destination, buf.String())
}

View File

@ -60,6 +60,7 @@ func split(filename string) {
}
if len(strings.TrimSpace(metadata)) > 0 {
writeMetadata(filename, metadata)
os.Remove(filename) // remove hardlink before writing
goutil.WriteFile(filename, data)
}
}