@martin-pettersson/wp-get-file-data

0.1.1 • Public • Published

wp-get-file-data

A port of the get_file_data method from WordPress used to extract parameters from header comment.

Usage

It's simple! Just require the module and use the provided methods.

var wpGetFileData = require('@martin-pettersson/wp-get-file-data');

// get the fields asynchronously
wpGetFileData.getFileData('some/file.php', function(err, fileData) {
    if (err) {
        // handle error
    }

    // ...
});

// get the fields synchronously
var fileData = wpGetFileData.getFileDataSync('some/file.css');

// ...

// fileData is an object containing the keys and trimmed values from the file header

Readme

Keywords

Package Sidebar

Install

npm i @martin-pettersson/wp-get-file-data

Weekly Downloads

15

Version

0.1.1

License

GPL-2.0

Unpacked Size

5.65 kB

Total Files

8

Last publish

Collaborators

  • martin-pettersson