Add cache busting config to support Tailwind 3

Fixes #10974
This commit is contained in:
Bjørn Erik Pedersen
2023-05-21 14:25:16 +02:00
parent 1292d5a26a
commit 2c3d4dfb74
12 changed files with 266 additions and 60 deletions

View File

@@ -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)
}
}
}