Skip to content
Revisioning CSS/JS appending a hash in you assets of wordpress theme
Branch: master
Clone or download
raul raul
raul and raul update readme
Latest commit 9135476 Mar 10, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
.editorconfig
.gitattributes
.gitignore
.jshintrc
.npmignore
.travis.yml
LICENSE
README.md
index.js
package.json
test.js

README.md

gulp-wp-rev

gulp-wp-rev plugin for gulp

Revisioning CSS/JS appending a hash in you assets of wordpress theme.

styles.css?ver=1styles.css?ver=bd0622b828f9346876088cd617566fa5

demo

Usage

First, install gulp-wp-rev as a development dependency:

npm install --save-dev gulp-wp-rev

Then, add it to your gulpfile.js:

var wpRev = require('gulp-wp-rev');

gulp.task('rev', function() {
	gulp.src('./wp-content/themes/raulghm-theme/lib/scripts.php')
	.pipe(wpRev([
		{
			handle: 'my-styles',
			file: './style.css',
			type: 'css'
		},
		{
			handle: 'vendor-scripts',
			file: './vendor.js',
			type: 'js'
		},
		{
			handle: 'my-scripts',
			file: './scripts.js',
			type: 'js'
		},
	]))
	.pipe(gulp.dest('./wp-content/themes/raulghm-theme/lib'));
});

API

wp-rev(options)

options

Type: Array of Objects.

Each object describes a resource and has three attributes:

options[*].handle

Type: String

Name used as the handle in WordPress

options[*].file

Type: String

Name of the file source.

options[*].type

Type: String

Type of resource, either js or css.

License

MIT © raulghm

You can’t perform that action at this time.