stephenlacy/gulp-bump

Does it support WordPress themes and plugins?

geminorum opened this issue · 3 comments

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:

define( 'MY_PLUGIN_VERSION', '1.2.1' );

anyway that can happen with a task?

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?