Closed geminorum closed 7 years ago
This will bump any text file, for the variable use a custom regex
after testing, It works fine on WordPress theme/plugin files.
for constants, I recommend this:
gulp.task('bump:constant', function(){
return gulp.src('./myplugin.php')
.pipe(bump({
regex: new RegExp( "([<|\'|\"]?MY_PLUGIN_VERSION[>|\'|\"]?[ ]*[:=,]?[ ]*[\'|\"]?[a-z]?)(\\d+\\.\\d+\\.\\d+)(-[0-9A-Za-z\.-]+)?([\'|\"|<]?)", "i" ),
}))
.pipe(gulp.dest('.'));
});
it's the same regex from `bump-regex`, I've just added comma to the delimiter char set.
Do you want to send a pr with that example to the examples folder/gulpfile?
Can I define a task to bump a WordPress theme, or a plugin?
also we usually define version as php constant to use anywhere on the code:
anyway that can happen with a task?