Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 1.55 KB

README.md

File metadata and controls

78 lines (55 loc) · 1.55 KB

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