all repos — website @ 879cc25421c66a959ab801f0937b4264a461fc7e

My website

use pointer to config in builder & templates

Alan Pearce
commit

879cc25421c66a959ab801f0937b4264a461fc7e

parent

d07ec650aafcfe4692bba8f481bc3cb8204cd4b0

1 file changed, 10 insertions(+), 7 deletions(-)

changed files
M internal/builder/builder.gointernal/builder/builder.go
@@ -86,7 +86,7 @@
return nil } -func build(outDir string, config config.Config) (*Result, error) { +func build(outDir string, config *config.Config) (*Result, error) { log.Debug("output", "dir", outDir) r := &Result{ Hashes: make([]string, 0),
@@ -252,16 +252,19 @@
return r, nil } -func BuildSite(ioConfig IOConfig) (*Result, error) { - config, err := config.GetConfig() - if err != nil { - return nil, errors.WithMessage(err, "could not get config") +func BuildSite(ioConfig IOConfig, cfg *config.Config) (*Result, error) { + if cfg == nil { + var err error + cfg, err = config.GetConfig() + if err != nil { + return nil, errors.WithMessage(err, "could not get config") + } } - config.InjectLiveReload = ioConfig.Development + cfg.InjectLiveReload = ioConfig.Development compressFiles = !ioConfig.Development templates.Setup() loadCSS() - return build(ioConfig.Destination, *config) + return build(ioConfig.Destination, cfg) }