wp-theme-semver-bump

0.2.0 • Public • Published

WP theme semantic versioning

A small utility that bumps WordPress theme versions using semantic versioning. Useful for cache-busting production sites.

Usage

Terminal

In the theme's folder, run

npx wp-theme-semver-bump

In a script (e.g. gulp)

const bump = require('wp-theme-semver-bump')
// ...
bump()

Arguments

Release type

npx wp-theme-semver-bump minor

or

bump('minor')

Custom file location

npx wp-theme-semver-bump patch relative/path/to/style.css

or

bump('patch', './relative/path/to/style.css')

Why?

The main use case is cache busting in production. No more "Try emptying the cache or opening in an incognito tab"!

The theme version can be appended to enqueued assets:

// functions.php or wherever you enqueue assets

// get the Version value from the theme's root style.css
$theme_version = wp_get_theme()->get('Version'); 

// append the version no. to the asset's src / href, e.g. 'theme/css/style.min.css?ver=0.1.0'
wp_enqueue_style('style', get_stylesheet_directory_uri() . '/css/style.min.css', [], $theme_version);

Package Sidebar

Install

npm i wp-theme-semver-bump

Weekly Downloads

16

Version

0.2.0

License

MIT

Unpacked Size

6.82 kB

Total Files

8

Last publish

Collaborators

  • landjonathan