From 2cd90c7b9978c81b44b1dd5729415bef474c29b8 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sat, 7 Mar 2020 10:55:44 -0600 Subject: [PATCH] Added config support for specifying the output file prefix This was hardcoded to "app-" because that's what I wanted mine to use. No real reason it has to be that way, though. Only offering a prefix is still pretty limiting, but better than hardcoding. --- compile.go | 2 +- config.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compile.go b/compile.go index 9a4a042..6e75e12 100644 --- a/compile.go +++ b/compile.go @@ -104,7 +104,7 @@ func finalize(config Config, buf map[FileType]*bytes.Buffer) (map[FileType]*Comp return nil, err } - destFile := filepath.Join(dir, "app-"+ret[key].Hash+ext) + destFile := filepath.Join(dir, config.FilePrefix+ret[key].Hash+ext) if err := ioutil.WriteFile(destFile, bytes, 0644); err != nil { return nil, err } diff --git a/config.go b/config.go index 691eda2..3c5ef23 100644 --- a/config.go +++ b/config.go @@ -8,4 +8,6 @@ type Config struct { Minify bool // OutputDir if specified will cause the result to be written to this directory OutputDir string + // FilePrefix is a string that will be prefixed on the files if OutputDir is specified + FilePrefix string }