summaryrefslogtreecommitdiffstats
path: root/resources
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 /resources
parent1292d5a26af55ffd22512a01ae3a82c769e9bb01 (diff)
Add cache busting config to support Tailwind 3
Fixes #10974
Diffstat (limited to 'resources')
-rw-r--r--resources/resource_cache.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/resources/resource_cache.go b/resources/resource_cache.go
index 8b0b363c9..388e293e8 100644
--- a/resources/resource_cache.go
+++ b/resources/resource_cache.go
@@ -24,7 +24,7 @@ import (
"github.com/gohugoio/hugo/helpers"
- "github.com/gohugoio/hugo/hugofs/glob"
+ hglob "github.com/gohugoio/hugo/hugofs/glob"
"github.com/gohugoio/hugo/resources/resource"
@@ -83,7 +83,7 @@ var extAliasKeywords = map[string][]string{
// e.g. "scss" will also return "sass".
func ResourceKeyPartitions(filename string) []string {
var partitions []string
- filename = glob.NormalizePath(filename)
+ filename = hglob.NormalizePath(filename)
dir, name := path.Split(filename)
ext := strings.TrimPrefix(path.Ext(filepath.ToSlash(name)), ".")
@@ -282,7 +282,7 @@ func (c *ResourceCache) DeletePartitions(partitions ...string) {
}
}
-func (c *ResourceCache) DeleteMatches(re *regexp.Regexp) {
+func (c *ResourceCache) DeleteMatchesRe(re *regexp.Regexp) {
c.Lock()
defer c.Unlock()
@@ -292,3 +292,14 @@ func (c *ResourceCache) DeleteMatches(re *regexp.Regexp) {
}
}
}
+
+func (c *ResourceCache) DeleteMatches(match func(string) bool) {
+ c.Lock()
+ defer c.Unlock()
+
+ for k := range c.cache {
+ if match(k) {
+ delete(c.cache, k)
+ }
+ }
+}