fork of anirudh.fi/vite that uses chroma for hl
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Copy static dir into build

+40 -6
+1
atom/feed.go
··· 47 47 Entries []AtomEntry 48 48 } 49 49 50 + // Creates a new Atom feed. 50 51 func NewAtomFeed(srcDir string, posts []markdown.Output) ([]byte, error) { 51 52 entries := []AtomEntry{} 52 53 config := config.Config
+17 -6
commands/build.go
··· 17 17 BUILD = "build" 18 18 PAGES = "pages" 19 19 TEMPLATES = "templates" 20 + STATIC = "static" 20 21 ) 21 22 22 23 type Pages struct { ··· 180 181 // copies over non .md files, etc. 181 182 func Build() error { 182 183 pages := Pages{} 183 - err := pages.initPages() 184 - if err != nil { 184 + if err := pages.initPages(); err != nil { 185 + return err 186 + } 187 + 188 + // Clean the build directory. 189 + if err := util.Clean(BUILD); err != nil { 185 190 return err 186 191 } 187 192 188 193 // Deal with files. 189 194 // ex: pages/{_index,about,etc}.md 190 - err = pages.processFiles() 191 - if err != nil { 195 + if err := pages.processFiles(); err != nil { 192 196 return err 193 197 } 194 198 195 199 // Deal with dirs -- i.e. dirs of markdown files. 196 200 // ex: pages/{blog,travel}/*.md 197 - err = pages.processDirs() 198 - if err != nil { 201 + if err := pages.processDirs(); err != nil { 202 + return err 203 + } 204 + 205 + // Copy the static directory into build 206 + // ex: build/static/ 207 + buildStatic := filepath.Join(BUILD, STATIC) 208 + os.Mkdir(buildStatic, 0755) 209 + if err := util.CopyDir(STATIC, buildStatic); err != nil { 199 210 return err 200 211 } 201 212
+22
util/rmall.go
··· 1 + package util 2 + 3 + import ( 4 + "os" 5 + "path/filepath" 6 + ) 7 + 8 + // Cleans a given directory, removing all files and subdirs. 9 + func Clean(dir string) error { 10 + files, err := filepath.Glob(filepath.Join(dir, "*")) 11 + if err != nil { 12 + return err 13 + } 14 + 15 + for _, file := range files { 16 + err = os.RemoveAll(file) 17 + if err != nil { 18 + return err 19 + } 20 + } 21 + return nil 22 + }