Node.js plugin that adds 'File Header' to Wordpress Theme's style.css file based on package.json data
For now works only with style.css file (supports only WP Themes, not plugins)
$ npm i gulp-wp-file-header --save-dev
Creates this: style.css
/*
Theme Name: MySuper Theme
Theme URI: http://example.com/
Description: MySuper is a modern responsive WordPress theme
Version: 0.0.1
Author: Denis Oleynik <[email protected]>
Tags: flat,modern,responsive,mobile-first,portfolio,corporate,multi-purpose
*/
From this: package.json
{
"name": "MySuper Theme",
"version": "0.0.1",
"author": "Denis Oleynik <[email protected]>",
"homepage": "http://example.com/",
"description": "MySuper is a modern responsive WordPress theme",
"keywords": [
"flat",
"modern",
"responsive",
"mobile-first",
"portfolio",
"corporate",
"multi-purpose"
],
"private": true,
"engines": {
"node": ">= 0.12.0",
"npm": ">=2.1.5"
}
}
var wp = require('gulp-wp-file-header')('./package.json');
wp.patch('./style.css', function(err){
// done
});
or just
var wp = require('gulp-wp-file-header')();
wp.patch();
var gulp = require('gulp');
var wp = require('gulp-wp-file-header')('./package.json');
gulp.task('wp', function () {
wp.patch('./style.css', function(err){
// done
});
});
module.exports = function(grunt) {
var wp = require('gulp-wp-file-header')('./package.json');
grunt.registerTask('wp', function() {
var done = this.async();
wp.patch('./style.css', function(err){
done();
});
});
};