diff --git a/media/mediaType.go b/media/mediaType.go index 817ea1ba8..d3f212ad3 100644 --- a/media/mediaType.go +++ b/media/mediaType.go @@ -166,13 +166,14 @@ var ( TSXType = newMediaType("text", "tsx", []string{"tsx"}) JSXType = newMediaType("text", "jsx", []string{"jsx"}) - JSONType = newMediaType("application", "json", []string{"json"}) - RSSType = newMediaTypeWithMimeSuffix("application", "rss", "xml", []string{"xml"}) - XMLType = newMediaType("application", "xml", []string{"xml"}) - SVGType = newMediaTypeWithMimeSuffix("image", "svg", "xml", []string{"svg"}) - TextType = newMediaType("text", "plain", []string{"txt"}) - TOMLType = newMediaType("application", "toml", []string{"toml"}) - YAMLType = newMediaType("application", "yaml", []string{"yaml", "yml"}) + JSONType = newMediaType("application", "json", []string{"json"}) + WebAppManifestType = newMediaTypeWithMimeSuffix("application", "manifest", "json", []string{"webmanifest"}) + RSSType = newMediaTypeWithMimeSuffix("application", "rss", "xml", []string{"xml"}) + XMLType = newMediaType("application", "xml", []string{"xml"}) + SVGType = newMediaTypeWithMimeSuffix("image", "svg", "xml", []string{"svg"}) + TextType = newMediaType("text", "plain", []string{"txt"}) + TOMLType = newMediaType("application", "toml", []string{"toml"}) + YAMLType = newMediaType("application", "yaml", []string{"yaml", "yml"}) // Common image types PNGType = newMediaType("image", "png", []string{"png"}) @@ -206,6 +207,7 @@ var DefaultTypes = Types{ TSXType, JSXType, JSONType, + WebAppManifestType, RSSType, XMLType, SVGType, diff --git a/minifiers/minifiers.go b/minifiers/minifiers.go index e76e56afd..3ac285ecb 100644 --- a/minifiers/minifiers.go +++ b/minifiers/minifiers.go @@ -78,7 +78,7 @@ func New(mediaTypes media.Types, outputFormats output.Formats, cfg config.Provid } if !conf.DisableJSON { addMinifier(m, mediaTypes, "json", &conf.Tdewolff.JSON) - m.AddRegexp(regexp.MustCompile(`^(application|text)/(x-|ld\+)?json$`), &conf.Tdewolff.JSON) + m.AddRegexp(regexp.MustCompile(`^(application|text)/(x-|(ld|manifest)\+)?json$`), &conf.Tdewolff.JSON) } if !conf.DisableSVG { addMinifier(m, mediaTypes, "svg", &conf.Tdewolff.SVG) diff --git a/output/outputFormat.go b/output/outputFormat.go index a52f43c8b..a2ffd7993 100644 --- a/output/outputFormat.go +++ b/output/outputFormat.go @@ -143,6 +143,14 @@ var ( Rel: "alternate", } + WebAppManifestFormat = Format{ + Name: "WebAppManifest", + MediaType: media.WebAppManifestType, + BaseName: "manifest", + IsPlainText: true, + Rel: "manifest", + } + RobotsTxtFormat = Format{ Name: "ROBOTS", MediaType: media.TextType, @@ -176,6 +184,7 @@ var DefaultFormats = Formats{ CSVFormat, HTMLFormat, JSONFormat, + WebAppManifestFormat, RobotsTxtFormat, RSSFormat, SitemapFormat,