All Projects → raulghm → gulp-wp-rev

raulghm / gulp-wp-rev

Licence: MIT license
Revisioning CSS/JS appending a hash in you assets of wordpress theme

Programming Languages

javascript
184084 projects - #8 most used programming language
PHP
23972 projects - #3 most used programming language
CSS
56736 projects

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].