]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
media: Rename application/javascript, application/typescript to text/javascript etc.
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 5 Oct 2022 07:26:30 +0000 (09:26 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 26 Oct 2022 08:38:27 +0000 (10:38 +0200)
The former is deprecated.

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
See https://discourse.gohugo.io/t/mime-type-for-javascript-is-now-text-javascript/40813

media/mediaType.go
media/mediaType_test.go
tpl/resources/integration_test.go

index 3ac3123ac81881de7451fb8f8aadbfa30b386449..e47acb1e34eff1fe5e354439073cf0577caa695c 100644 (file)
@@ -230,8 +230,8 @@ var (
        SASSType       = newMediaType("text", "x-sass", []string{"sass"})
        CSVType        = newMediaType("text", "csv", []string{"csv"})
        HTMLType       = newMediaType("text", "html", []string{"html"})
-       JavascriptType = newMediaType("application", "javascript", []string{"js", "jsm", "mjs"})
-       TypeScriptType = newMediaType("application", "typescript", []string{"ts"})
+       JavascriptType = newMediaType("text", "javascript", []string{"js", "jsm", "mjs"})
+       TypeScriptType = newMediaType("text", "typescript", []string{"ts"})
        TSXType        = newMediaType("text", "tsx", []string{"tsx"})
        JSXType        = newMediaType("text", "jsx", []string{"jsx"})
 
index af7123cb5cd2600caab355de6a01117190d35a5c..2a1b4884999ce728be3ae83ade0feb10ec01d291 100644 (file)
@@ -40,8 +40,8 @@ func TestDefaultTypes(t *testing.T) {
                {SCSSType, "text", "x-scss", "scss", "text/x-scss", "text/x-scss"},
                {CSVType, "text", "csv", "csv", "text/csv", "text/csv"},
                {HTMLType, "text", "html", "html", "text/html", "text/html"},
-               {JavascriptType, "application", "javascript", "js", "application/javascript", "application/javascript"},
-               {TypeScriptType, "application", "typescript", "ts", "application/typescript", "application/typescript"},
+               {JavascriptType, "text", "javascript", "js", "text/javascript", "text/javascript"},
+               {TypeScriptType, "text", "typescript", "ts", "text/typescript", "text/typescript"},
                {TSXType, "text", "tsx", "tsx", "text/tsx", "text/tsx"},
                {JSXType, "text", "jsx", "jsx", "text/jsx", "text/jsx"},
                {JSONType, "application", "json", "json", "application/json", "application/json"},
index 06f98eeee9f7be65e0bd3e691cca31c408cd0aa8..7662f7b6b790cf76036303085efdf0f526efdf3e 100644 (file)
@@ -65,10 +65,10 @@ Image Orig:  /blog/images/pixel.png|image/png|1|1|
 Image Copy1:  /blog/images/copy_hu8aa3346827e49d756ff4e630147c42b5_70_3x4_resize_box_3.png|image/png|3|4|
 Image Copy2:  /blog/images/copy2.png|image/png|3|4
 Image Copy3:  image/png|3|4|
-Orig: /blog/js/foo.js|application/javascript|let foo;|
-Copy1: /blog/js/copies/bar.js|application/javascript|let foo;|
-Copy2: /blog/js/copies/baz.a677329fc6c4ad947e0c7116d91f37a2.js|application/javascript|let foo;|
-Copy3: /blog/js/copies/moo.a677329fc6c4ad947e0c7116d91f37a2.min.js|application/javascript|let foo|
+Orig: /blog/js/foo.js|text/javascript|let foo;|
+Copy1: /blog/js/copies/bar.js|text/javascript|let foo;|
+Copy2: /blog/js/copies/baz.a677329fc6c4ad947e0c7116d91f37a2.js|text/javascript|let foo;|
+Copy3: /blog/js/copies/moo.a677329fc6c4ad947e0c7116d91f37a2.min.js|text/javascript|let foo|
 
                `)