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:
@ -104,7 +104,7 @@ func finalize(config Config, buf map[FileType]*bytes.Buffer) (map[FileType]*Comp
|
|||||||
return nil, err
|
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 {
|
if err := ioutil.WriteFile(destFile, bytes, 0644); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -8,4 +8,6 @@ type Config struct {
|
|||||||
Minify bool
|
Minify bool
|
||||||
// OutputDir if specified will cause the result to be written to this directory
|
// OutputDir if specified will cause the result to be written to this directory
|
||||||
OutputDir string
|
OutputDir string
|
||||||
|
// FilePrefix is a string that will be prefixed on the files if OutputDir is specified
|
||||||
|
FilePrefix string
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user