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.
This commit is contained in:
2020-03-07 10:55:44 -06:00
parent 332d48dd33
commit 2cd90c7b99
2 changed files with 3 additions and 1 deletions

View File

@ -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
}

View File

@ -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
}