Skip to content

Commit 7f2213f

Browse files
added cache busting
1 parent b988a44 commit 7f2213f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/css-file-generator.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ public static function get_css_file_url() {
6060
public static function get_css_file_name() {
6161
$css_content = static::generate_css_content();
6262
$content_hash = md5( $css_content );
63-
return static::get_css_file_prefix() . $content_hash . '.css';
63+
64+
// Add a timestamp as cache buster to ensure unique file names
65+
$timestamp = time();
66+
67+
return static::get_css_file_prefix() . $content_hash . '-' . $timestamp . '.css';
6468
}
6569

6670
/**
@@ -214,6 +218,9 @@ public static function invalidate_css_file() {
214218
unlink( $old_file_path );
215219
}
216220
}
221+
222+
// Clear the cached file name - next generation will have a new timestamp
223+
delete_option( static::get_cache_option_name() );
217224
}
218225
}
219226
}

0 commit comments

Comments
 (0)