plugin-icon

Dynamic Asset Versioning

제작자: Steve Grunwell·
Dynamically set asset version numbers based on file modification times, preventing stale caches.
등급
5/5
버전
0.1.0
활성화된 설치 항목
40
최근 업데이트일
Dec 14, 2016

WordPress asset versioning can be a double-edged sword: on one-hand, it’s extremely effective for cache-busting, ensuring you aren’t sharing stale scripts or styles to your visitors. On the other hand, having to manually increment a version number is a pain (even as a constant), often resulting in a version control history full of “bumping the version number” commits.

Dynamic Asset Versioning aims to simplify this process: if an enqueued asset doesn’t have an explicit version number, the plugin will get the timestamp of the last time the file was changed and use that as the version number. It’s easy: you touch the file, the version number is updated automatically.

Usage

Once Dynamic Asset Versioning is active, it will automatically determine version numbers based on file modification time for any [non-core] files that have been enqueued using wp_enqueue_style() or wp_enqueue_script().

Example

wp_enqueue_style( 'my-theme-styles', get_template_directory_uri() . '/assets/css/my-styles.css', array( 'some-other-styles' ), false, // Don't worry about it, Dynamic Asset Versioning has you covered! 'screen' );

Special thanks

A special thanks goes out to 10up, who helped inspire the original concept of this plugin.

무료Business 요금제에서
설치하면 WordPress.com 서비스 약관서드파티 플러그인 약관에 동의하게 됩니다.
테스트된 버전
WordPress 4.7.31
이 플러그인은 다운로드할 수 있으며 에서 사용할 수 있습니다.