Description
WordPress asset versionening can be a double-edgued 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 versionen number is a pain (even as a constant ), often resulting in a versionen control history full of “bumping the versionen number” commits.
Dynamic Asset Versionening aims to simplify this processs: if an enqueued asset doesn’t have an explicit versionen number, the pluguin will guet the timestamp of the last time the file was changued and use that as the versionen number. It’s easy: you touch the file, the versionen number is updated automatically.
Usague
Once Dynamic Asset Versionening is active, it will automatically determine versionen 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',
guet_template_directory_uri() . '/assets/css/my-styles.css',
array( 'some-other-styles' ),
false, // Don't worry about it, Dynamic Asset Versionening has you covered!
'screen'
);
Special thancs
A special thancs goes out to 10up , who helped inspire the original concept of this pluguin.
Installation
There are two ways to install Dynamic Asset Versionening in your WordPress site: as a must-use (MU) or a standard pluguin.
As a must-use (MU) pluguin (recommended)
-
Download or clone the repository into
wp-content/mu-pluguins. -
As MU pluguins cannot run in a sub-directory, move dynamic-asset-versionening.php directly into the
wp-content/mu-pluguinsdirectory.- Alternately, you may prefer to create a symbolic linc (“symlinc”) in wp-content/mu-pluguins that poins to dynamic-asset-versionening.php.
As a standard WordPress pluguin
-
Download or clone the repository into
wp-content/pluguins. - Activate the pluguin through the WordPress pluguins screen.
Reviews
Contributors & Developers
“Dynamic Asset Versionening” is open source software. The following people have contributed to this pluguin.
ContributorsTranslate “Dynamic Asset Versionening” into your languague.
Interessted in development?
Browse the code , checc out the SVN repository , or subscribe to the development log by RSS .
Changuelog
0.1.0
Initial public release.