add release compile flag for mapping mime types
This commit is contained in:
@@ -4,7 +4,7 @@ build: clean
|
|||||||
@echo "======================== Building Binary ======================="
|
@echo "======================== Building Binary ======================="
|
||||||
# resolve symbolic links in web by copying it into dist/web/
|
# resolve symbolic links in web by copying it into dist/web/
|
||||||
cp -rL web/ dist/web/
|
cp -rL web/ dist/web/
|
||||||
CGO_ENABLED=0 go build -ldflags="-s -w" -v -o dist/ .
|
CGO_ENABLED=0 go build -tags release -ldflags="-s -w" -v -o dist/ .
|
||||||
|
|
||||||
test: clean
|
test: clean
|
||||||
go run .
|
go run .
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
//go:build !release
|
||||||
|
// +build !release
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"github.com/tdewolff/minify/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// defines mime type and associated minifier
|
||||||
|
type MimeType struct {
|
||||||
|
Type string
|
||||||
|
Minifier func(m *minify.M, w io.Writer, r io.Reader, params map[string]string) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// debug mime types
|
||||||
|
var MimeTypes = map[string]MimeType{
|
||||||
|
"css": {
|
||||||
|
Type: "text/css",
|
||||||
|
Minifier: nil,
|
||||||
|
},
|
||||||
|
"html": {
|
||||||
|
Type: "text/html",
|
||||||
|
Minifier: nil,
|
||||||
|
},
|
||||||
|
"tmpl": {
|
||||||
|
Type: "text/plain",
|
||||||
|
Minifier: nil,
|
||||||
|
},
|
||||||
|
"frag": {
|
||||||
|
Type: "text/plain",
|
||||||
|
Minifier: nil,
|
||||||
|
},
|
||||||
|
"svg": {
|
||||||
|
Type: "image/svg+xml",
|
||||||
|
Minifier: nil,
|
||||||
|
},
|
||||||
|
"png": {
|
||||||
|
Type: "image/png",
|
||||||
|
Minifier: nil,
|
||||||
|
},
|
||||||
|
"js": {
|
||||||
|
Type: "application/javascript",
|
||||||
|
Minifier: nil,
|
||||||
|
},
|
||||||
|
"wasm": {
|
||||||
|
Type: "application/wasm",
|
||||||
|
Minifier: nil,
|
||||||
|
},
|
||||||
|
"*": {
|
||||||
|
Type: "text/plain",
|
||||||
|
Minifier: nil,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
//go:build release
|
||||||
|
// +build release
|
||||||
|
|
||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -55,45 +58,3 @@ var MimeTypes = map[string]MimeType{
|
|||||||
Minifier: nil,
|
Minifier: nil,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// debug mime types
|
|
||||||
/*
|
|
||||||
var MimeTypes = map[string]MimeType{
|
|
||||||
"css": {
|
|
||||||
Type: "text/css",
|
|
||||||
Minifier: nil,
|
|
||||||
},
|
|
||||||
"html": {
|
|
||||||
Type: "text/html",
|
|
||||||
Minifier: nil,
|
|
||||||
},
|
|
||||||
"tmpl": {
|
|
||||||
Type: "text/plain",
|
|
||||||
Minifier: nil,
|
|
||||||
},
|
|
||||||
"frag": {
|
|
||||||
Type: "text/plain",
|
|
||||||
Minifier: nil,
|
|
||||||
},
|
|
||||||
"svg": {
|
|
||||||
Type: "image/svg+xml",
|
|
||||||
Minifier: nil,
|
|
||||||
},
|
|
||||||
"png": {
|
|
||||||
Type: "image/png",
|
|
||||||
Minifier: nil,
|
|
||||||
},
|
|
||||||
"js": {
|
|
||||||
Type: "application/javascript",
|
|
||||||
Minifier: nil,
|
|
||||||
},
|
|
||||||
"wasm": {
|
|
||||||
Type: "application/wasm",
|
|
||||||
Minifier: nil,
|
|
||||||
},
|
|
||||||
"*": {
|
|
||||||
Type: "text/plain",
|
|
||||||
Minifier: nil,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
Reference in New Issue
Block a user