Add wildcard support
This commit is contained in:
@ -42,7 +42,9 @@ func supportedFileType(t FileType) bool {
|
|||||||
func getBytes(config Config, minifier *minify.M) (map[FileType]*bytes.Buffer, error) {
|
func getBytes(config Config, minifier *minify.M) (map[FileType]*bytes.Buffer, error) {
|
||||||
buf := make(map[FileType]*bytes.Buffer)
|
buf := make(map[FileType]*bytes.Buffer)
|
||||||
|
|
||||||
for _, file := range config.Files {
|
for _, pattern := range config.Files {
|
||||||
|
files, _ := filepath.Glob(pattern)
|
||||||
|
for _, file := range files {
|
||||||
if file, err := os.Open(file); err == nil {
|
if file, err := os.Open(file); err == nil {
|
||||||
ext := FileType(filepath.Ext(file.Name())[1:])
|
ext := FileType(filepath.Ext(file.Name())[1:])
|
||||||
if !supportedFileType(ext) {
|
if !supportedFileType(ext) {
|
||||||
@ -67,6 +69,7 @@ func getBytes(config Config, minifier *minify.M) (map[FileType]*bytes.Buffer, er
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return buf, nil
|
return buf, nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user