wp-project-header

Automatically determines a plugin or theme's header file.

Usage no npm install needed!

<script type="module">
  import wpProjectHeader from 'https://cdn.skypack.dev/wp-project-header';
</script>

README

wp-project-header

Easily get a project's header file, theme or plugin.

Don't go through the hassle of determining if your module is running in a theme or a plugin everytime you need to determine the projects header file.

Install

Install with yarn:

$ yarn add wp-project-header --dev

OR

Install with npm:

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

Usage

const projectHeader = require( 'wp-project-header' );

( async () => {
    /* Inside a Plugin */
    console.log( await projectHeader() );
    //=> '/path/to/your-plugin/your-plugin.php';'

    /* Inside a Theme */
    console.log( await projectHeader() );
    //=> '/path/to/your-theme/style.css';'
} )();