summaryrefslogtreecommitdiffstats
path: root/hugofs
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-21 14:25:16 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-22 14:14:35 +0200
commit2c3d4dfb745799b5de11f9ec0463a4ace19e97de (patch)
tree22f8dfe5b6f0bd39d66757119c2ea2ce5f83743d /hugofs
parent1292d5a26af55ffd22512a01ae3a82c769e9bb01 (diff)
Add cache busting config to support Tailwind 3
Fixes #10974
Diffstat (limited to 'hugofs')
-rw-r--r--hugofs/glob/glob.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/hugofs/glob/glob.go b/hugofs/glob/glob.go
index ec9b2c7e1..dc9b4fb5b 100644
--- a/hugofs/glob/glob.go
+++ b/hugofs/glob/glob.go
@@ -80,6 +80,31 @@ func (gc *globCache) GetGlob(pattern string) (glob.Glob, error) {
return eg.glob, eg.err
}
+// Or creates a new Glob from the given globs.
+func Or(globs ...glob.Glob) glob.Glob {
+ return globSlice{globs: globs}
+}
+
+// MatchesFunc is a convenience type to create a glob.Glob from a function.
+type MatchesFunc func(s string) bool
+
+func (m MatchesFunc) Match(s string) bool {
+ return m(s)
+}
+
+type globSlice struct {
+ globs []glob.Glob
+}
+
+func (g globSlice) Match(s string) bool {
+ for _, g := range g.globs {
+ if g.Match(s) {
+ return true
+ }
+ }
+ return false
+}
+
type globDecorator struct {
// On Windows we may get filenames with Windows slashes to match,
// which we need to normalize.