Skip to content

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

License

Notifications You must be signed in to change notification settings

raulghm/gulp-wp-rev

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •