@martin-pettersson/wp-get-file-data
v0.1.1
Published
A port of the get_file_data method from WordPress used to extract parameters from header comment.
Downloads
142
Readme
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