Skip to content

Gulp plugin that adds 'File Header' to Wordpress Theme's style.css file based on package.json

License

Notifications You must be signed in to change notification settings

oleynikd/gulp-wp-file-header

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-wp-file-header

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)

Installation

$ npm i gulp-wp-file-header --save-dev

Description

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"
    }
}

Usage

Plain

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();

With Gulp:

var gulp = require('gulp');
var wp   = require('gulp-wp-file-header')('./package.json');

gulp.task('wp', function () {
    wp.patch('./style.css', function(err){
        // done
    });
});

With Grunt:

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();
        });
    });
};

About

Gulp plugin that adds 'File Header' to Wordpress Theme's style.css file based on package.json

Resources

License

Stars

Watchers

Forks

Packages

No packages published