1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-03 10:17:03 +00:00

New iris.DirOptions.PushTargetsRegexp

rel to: https://github.com/kataras/iris/issues/1562#issuecomment-659702891


Former-commit-id: 778cf9146b730d424040ea9e259ce6500f53b563
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-07-18 06:10:16 +03:00
parent dab03102f3
commit 552f990358
4 changed files with 116 additions and 12 deletions

View File

@@ -2,6 +2,7 @@ package iris
import (
"net/http"
"regexp"
"github.com/kataras/iris/v12/cache"
"github.com/kataras/iris/v12/context"
@@ -216,6 +217,13 @@ var (
ctx.CompressReader(true)
ctx.Next()
}
// MatchCommonAssets is a simple regex expression which
// can be used on `DirOptions.PushTargetsRegexp`.
// It will match and Push
// all available js, css, font and media files.
// Ideal for Single Page Applications.
MatchCommonAssets = regexp.MustCompile("((.*).js|(.*).css|(.*).ico|(.*).png|(.*).ttf|(.*).svg|(.*).webp|(.*).gif)$")
)
var (