npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-wp-bump-all

v0.3.1

Published

Gulp task to bump your scripts and styles versions

Downloads

4

Readme

Gulp-wp-bump-all

Inspired by gulp-wp-bump, which didn't allow me to update multiple files or multiple search keys (enqueue_script and or enqueue_style).

So I made this possible for my own project.

Note: I am not understanding the bit so I decided (since the bump has nothing to do with the stream anyway)
to remove the steaming bit. Because of this, you have to run `bump` as a separate task now.

Install

Install via npm

npm i gulp-wp-bump-all -D

Usage

Bump multiple PHP files in your Wordpress themes or plugins The bump task is NOT using anything in the stream, since it is just going to amend the files that are mentioned in its arguments. It is currently just hooked in via a task.

var bump = require('gulp-wp-bump-all');

// ************** example **************
//
gulp.task( 'bump', function() {
	bump( [ 'lib/core/theme_loader.php', 'functions.php' ], {
		keys: [ 'wp_enqueue_style', 'wp_enqueue_script', 'wp_register_style' ]
	} );
} )


// any other task
//
gulp.task( 'styles', function() {
	gulp.src( 'sass/**/*.scss' )
	.pipe( sass().on('error', sass.logError ) )
	.pipe( gulp.dest('dist/css') );
} );

gulp.task( 'build', [ 'styles', 'bump' ] );

In the example I tell bump to look through two files and bump the following keys 'wp_enqueue_style', 'wp_enqueue_script', 'wp_register_style' with a new version (if they can be found.

I am only bumping if:

// The style or script register/enqueue has a name and file location defined, ergo:
wp_enqueue_style( 'theme', '/dist/css/style.css' );
// This will result in:
wp_enqueue_style( 'theme', '/dist/css/style.css', array(), '[HASH]' );

wp_enqueue_script( 'theme', '/dist/js/something.js', array( 'jquery' ), '1.0', true );
// will become
wp_enqueue_script( 'theme', '/dist/js/something.js', array( 'jquery' ), '[HASH]', true );

wp_enqueue_script( 'jquery' );
// will be ignored since I am missing the second argument (file location).
wp_enqueue_script( 'jquery' );

You can define any filename as long as the path is correct. If you do not define filter keys, fallback will be [ 'wp_enqueue_style', 'wp_enqueue_style]

Changelog

0.3.0 I have rewritten the regex replacement function to support dependency arrays with mulitple values. This wasn't possible before because my scenario didn't require it. Silly, of course.