wp-header-update

1.0.1 • Public • Published

wp-header-update

Easily update a value in your theme or plugin file headers.

Install

Install with yarn:

$ yarn add wp-header-update --dev

OR

Install with npm:

$ npm install wp-header-update --save-dev

Usage

const updateHeader = require( 'wp-header-update' );
 
( async () => {
    await updateHeader( 'Version', '2.0.0' );
} )();

Internally this uses wp-project-header to automatically determine if it's running inside of a theme or plugin, so you don't have to worry about passing the file path in.

Sometimes you might need to override that setting though, so a thid parameter for the path to a header file is available. For example getting a parent theme's version from style.css:

const updateHeader = require( 'wp-header-update' ),
    path = require( 'path' );
 
( async () => {
    await updateHeader( 'Version', '2.0.0', path.resolve( '../../themes/parent-theme/style.css' ) ).catch( console.error );
} )();

Dependents (1)

Package Sidebar

Install

npm i wp-header-update

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

9.7 kB

Total Files

6

Last publish

Collaborators

  • time