🚀 A yeoman generator for Wordpress projects with custom templates support.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
__tests__
generators
utils
.editorconfig
.eslintignore
.gitattributes
.gitignore
.snyk
.travis.yml
.yo-rc.json
LICENSE
README.md
_config.yml
banner.jpg
package-lock.json
package.json

README.md

banner

NPM version Build Status Dependency Status Coverage percentage Slack Chat

generator-wordpress-starter

A simple yeoman generator for Wordpress projects.

Installation

First, install Yeoman and generator-wordpress-starter using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-wordpress-starter

To generate a new project just type the string below, the generator will create the folder for you if not exists:

yo wordpress-starter

It will be made a bit of questions then you will have your project ready to go.

You can also generate plugins, by typing:

yo wordpress-starter:plugin

Generate a custom theme

The project allow you to generate custom WordPress themes from templates located in ~/.wordpress-starter/ folder.

  • Create a .wordpress-starter directory and place it inside your home folder.
  • Place your themes inside that folder and follow some simple rules.
  • When your template is ready you can use it with --template TemplateName

You must create the folder if doesn't exist and place your themes inside like in this example:

tree ~/.wordpress-starter/
├───Simple
└───Advanced

Every theme folder must follow simple rules in order to been generated correctly.

tree ~/.wordpress-starter/Simple
└───theme

In this example the Simple theme has only the theme directory where you should put all the theme files like in the default theme that comes with the generator.

Optionally you can also generate more complex projects, that uses build systems, for now the generator will support only gulp and grunt, if you are not familiar with them, be sure to check out the Getting Started guides. In order to archive this result you must follow this structure:

tree ~/.wordpress-starter/Simple
├───grunt
├───gulp
└───theme

You can take a look at the example which is the default theme generated if you don't specify a custom one.

As you can see in the default template, you can access the prompt variables inside the template during render process.

This are all the variables available right now:

  • projectName: The project name as slug
  • projectTitle: The full project title as it appears on WordPress repositories
  • projectDescription: A short project description
  • projectManager: The build system used for the project (grunt, gulp)
  • projectVersion: The version when the project has started
  • projectAuthor: The project author name

Simply use it like this: <%= projectName %> inside your files to have it rendered with the value.

Inside the theme folder you will always put all the themes related files (scripts, templates, assets, ...) while in the gulp/grunt folder you should put only the files that are related with your project build system configuration.

In the grunt/gulp folder, you must place only two files: package.json and gulpfile.js or Gruntfile.js, any other file will be ignored.

The package.json file will be rendered with EJS interpolation, while the other file will be simply copied since it uses itself ESJ during it's job.


Development

To develop this package you must clone it with Git and than link it to your global npm modules by typing:

npm link

Than you can start editing the package by following the contribuing guidelines below and than testing with: yo wordpress-starter, if you have any troubles please follow this guide, "Running the generator".


Contributing

  1. Create an issue and describe your idea
  2. Fork the project (https://github.com/codekraft-studio/generator-wordpress-starter/fork)
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Publish the branch (git push origin my-new-feature)
  6. Add some test for your new feature
  7. Create a new Pull Request

Getting To Know Yeoman

  • Yeoman has a heart of gold.
  • Yeoman is a person with feelings and opinions, but is very easy to work with.
  • Yeoman can be too opinionated at times but is easily convinced not to be.
  • Feel free to learn more about Yeoman.

License

Apache-2.0 © codekraft-studio