func (*minify) Process(ctx goldsmith.Context, f goldsmith.File) error { var ( buff bytes.Buffer err error ) switch m := min.New(); filepath.Ext(f.Path()) { case ".css": err = css.Minify(m, &buff, f, nil) case ".html", ".htm": err = html.Minify(m, &buff, f, nil) case ".js": err = js.Minify(m, &buff, f, nil) case ".json": err = json.Minify(m, &buff, f, nil) case ".svg": err = svg.Minify(m, &buff, f, nil) case ".xml": err = xml.Minify(m, &buff, f, nil) } if err != nil { return err } nf := goldsmith.NewFileFromData(f.Path(), buff.Bytes()) nf.CopyValues(f) ctx.DispatchFile(nf) return nil }
func Fuzz(data []byte) int { r := bytes.NewBuffer(data) err := svg.Minify(minify.New(), ioutil.Discard, r, nil) if err != nil { panic(err) } return 1 }