| @@ -63,8 +63,19 @@ | ||
| 63 | 63 | if ( $is_js ) { |
| 64 | 64 | $dependencies = array_unique( array_merge( $asset_config['dependencies'], $dependencies ) ); |
| 65 | 65 | } |
| 66 | 66 | $version = $asset_config['version']; |
| 67 | + } else { | |
| 68 | + // webpack only emits `<name>.asset.php` (with its content hash) for JS | |
| 69 | + // entries, so stylesheets used to fall through to the plugin version | |
| 70 | + // and never cache-busted between builds — browsers kept serving a | |
| 71 | + // stale CSS against freshly-changed markup. Fall back to the file's | |
| 72 | + // mtime so any rebuilt asset gets a new URL. | |
| 73 | + $asset_path = $this->dist_path( $filename ); | |
| 74 | + | |
| 75 | + if ( file_exists( $asset_path ) ) { | |
| 76 | + $version = (string) filemtime( $asset_path ); | |
| 77 | + } | |
| 67 | 78 | } |
| 68 | 79 | |
| 69 | 80 | return [ |
| 70 | 81 | 'url' => $url, |