GithubHelp home page GithubHelp logo

markjaquith / grunt-wp-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 10up/grunt-wp-plugin

33.0 5.0 4.0 87 KB

WordPress Plugin Project Templates

Shell 18.28% PHP 37.15% CSS 0.78% JavaScript 43.79%

grunt-wp-plugin's Introduction

grunt-wp-plugin

Create a WordPress plugin with grunt-init.

This is a customized version of 10up's grunt-wp-plugin, created for the personal use of me, Mark Jaquith.

I removed things I don't use (like SCSS, and LESS), and added things like:

  • CoffeeScript
  • CoffeeLint
  • PHPUnit (with grunt watch support)
  • Travis-CI
  • Replacement of plugin version numbers from package.json
  • WordPress.org plugins repo deployment
  • Sass
  • Compass
  • Source maps (for CoffeeScript and Sass)
  • Specification of minimum PHP and WordPress versions
  • A basic plugin skeleton, using an updated WP_Stack_Plugin2 class

How do I install this?

npm install -g grunt-init
mkdir ~/.grunt-init
cd ~/.grunt-init
git clone https://github.com/markjaquith/grunt-wp-plugin.git wp-plugin

How do I use this to generate a plugin?

mkdir /path/to/wp-content/plugins/your-plugin-slug
cd /path/to/wp-content/plugins/your-plugin-slug
grunt-init wp-plugin

Then follow the prompts. Be sure to give your plugin a unique class name. e.g. MTJ_Social_Sharing_Mullet_Explosion.

How do I use this to develop my plugin?

First, make sure you have grunt-cli installed.

npm install -g grunt-cli

Then, install the local packages, from within your plugin's directory:

npm install

To process everything:

grunt

To watch for changed .coffee, .sass, and .php files (and perform the appropriate task):

grunt watch

To run PHPUnit tests:

grunt phpunit

To sync changes up to the WordPress.org SVN plugin repository:

grunt release

Or, if you want to stage the SVN directory, just do:

grunt release:prepare

Notes

  • Don't forget that the version numbers in your plugin are controlled by package.json. That's the main place to update it.

  • If you have more than one Sass or CoffeeScript file, you'll have to add them to various places in Gruntfile.coffee (I want to refactor this to have just one array of files in the Gruntfile, so it's more DRY).

  • Note the assets directory for WordPress.org-hosted plugin banners.

  • PHPUnit support requires a globally available WordPress core install, and the following to be set: export WP_TESTS_DIR=/path/to/wp/checkout/trunk/tests/phpunit/

Can I contribute?

I made this for myself, and as a learning tool for others who want to use Grunt to help with their plugin development. But if you find it useful, and think you can improve it, send me a pull request! As of this writing, I'm only going to pull in changes if I find them personally useful (i.e. don't send me a pull request to reïntigrate LESS support, because I don't use LESS).

grunt-wp-plugin's People

Contributors

bradyvercher avatar ericmann avatar johnpbloch avatar markjaquith avatar oxocode avatar rachelbaker avatar tddewey avatar trepmal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.