Title: Dynamic Asset Versioning
Author: Steve Grunwell
Published: <strong>2016 年 12 月 12 日</strong>
Last modified: 2016 年 12 月 14 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/dynamic-asset-versioning.svg)

# Dynamic Asset Versioning

 作者：[Steve Grunwell](https://profiles.wordpress.org/stevegrunwell/)

[下载](https://downloads.wordpress.org/plugin/dynamic-asset-versioning.0.2.0.zip)

 * [详情](https://cn.wordpress.org/plugins/dynamic-asset-versioning/#description)
 * [评价](https://cn.wordpress.org/plugins/dynamic-asset-versioning/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/dynamic-asset-versioning/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/dynamic-asset-versioning/#developers)

 [支持](https://wordpress.org/support/plugin/dynamic-asset-versioning/)

## 描述

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](https://10up.github.io/Engineering-Best-Practices/php/#asset-versioning)),
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()`](https://developer.wordpress.org/reference/functions/wp_enqueue_style/)
or [`wp_enqueue_script()`](https://developer.wordpress.org/reference/functions/wp_enqueue_style/).

**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](http://10up.com), who helped inspire the original
concept of this plugin.

## 安装

There are two ways to install Dynamic Asset Versioning in your WordPress site: as
a must-use (MU) or a standard plugin.

#### As a must-use (MU) plugin (recommended)

 1. Download or clone the repository into `wp-content/mu-plugins`.
 2. As MU plugins cannot run in a sub-directory, move dynamic-asset-versioning.php 
    directly into the `wp-content/mu-plugins` directory.
 3.  * Alternately, [you may prefer to create a symbolic link (“symlink”) in wp-content/mu-plugins](https://stevegrunwell.com/blog/symlink-wordpress-mu-plugin/)
       that points to dynamic-asset-versioning.php.

#### As a standard WordPress plugin

 1. Download or clone the repository into `wp-content/plugins`.
 2. Activate the plugin through the WordPress plugins screen.

## 评价

![](https://secure.gravatar.com/avatar/3be48bc93d775dd4ae2a357aacc473cef94d21539f4d5b21cfa63b6fa3ce05e9?
s=60&d=retro&r=g)

### 󠀁[Amazing](https://wordpress.org/support/topic/amazing-1568/)󠁿

 [Deepak Khokhar](https://profiles.wordpress.org/deepakkite/) 2017 年 9 月 26 日

Exactly what I was looking for. Great stuff. Thanks guys

 [ 阅读所有1条评价 ](https://wordpress.org/support/plugin/dynamic-asset-versioning/reviews/)

## 贡献者及开发者

「Dynamic Asset Versioning」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Steve Grunwell ](https://profiles.wordpress.org/stevegrunwell/)
 *   [ Growella ](https://profiles.wordpress.org/growella/)

[帮助将「Dynamic Asset Versioning」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/dynamic-asset-versioning)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/dynamic-asset-versioning/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/dynamic-asset-versioning/)，或通过
[RSS](https://plugins.trac.wordpress.org/log/dynamic-asset-versioning/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/dynamic-asset-versioning/)。

## 更新日志

#### 0.1.0

Initial public release.

## 额外信息

 *  版本 **0.1.0**
 *  最后更新：**9 年前**
 *  活跃安装数量 **30+**
 *  WordPress 版本 ** 4.7 或更高版本 **
 *  已测试的最高版本为 **4.7.33**
 *  语言
 * [English (US)](https://wordpress.org/plugins/dynamic-asset-versioning/)
 * 标签
 * [assets](https://cn.wordpress.org/plugins/tags/assets/)[cache](https://cn.wordpress.org/plugins/tags/cache/)
   [versioning](https://cn.wordpress.org/plugins/tags/versioning/)
 *  [高级视图](https://cn.wordpress.org/plugins/dynamic-asset-versioning/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  1 条 5 星评价     ](https://wordpress.org/support/plugin/dynamic-asset-versioning/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/dynamic-asset-versioning/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/dynamic-asset-versioning/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/dynamic-asset-versioning/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/dynamic-asset-versioning/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/dynamic-asset-versioning/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/dynamic-asset-versioning/reviews/)

## 贡献者

 *   [ Steve Grunwell ](https://profiles.wordpress.org/stevegrunwell/)
 *   [ Growella ](https://profiles.wordpress.org/growella/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/dynamic-asset-versioning/)