Home

Awesome

grunt-wordpress

Grunt plugin for publishing content to WordPress using Gilded WordPress.

Support this project by donating on Gratipay.

Getting Started

grunt-wordpress works just like any other Grunt plugin. See the Config section for details on setting up the Grunt tasks.

Make sure to copy gilded-wordpress.php in to your WordPress install as a plugin.

For most projects, you should only need to specify the wordpress config and use the wordpress-deploy task (or its alias deploy).

Config

grunt.initConfig({
	wordpress: {
		url: "wordpress.dev",
		username: "admin",
		password: "admin",
		dir: "dist"
	}
});

Tasks

wordpress-validate

Walks through the wordpress.dir directory and performs various validations, such as:

wordpress-sync

Synchronizes everything in wordpress.dir to the WordPress site. This will create/edit/delete terms, posts, and resources.

Note: wordpress-validate must run prior to wordpress-sync.

wordpress-publish

Alias task for wordpress-validate and wordpress-sync. This is useful if your original source content is already in the proper format, or if you want to manually verify generated content between your custom build and publishing.

wordpress-deploy

Alias task for build-wordpress and wordpress-publish. This is useful if you are generating content for use with wordpess-sync. Simply create a build-wordpress task that populates the wordpress.dir directory and your deployments will be as simple as grunt wordpress-deploy.

deploy

Alias task for wordpress-deploy. Since most projects that use grunt-wordpress only have one deploy target (WordPress), there is a built-in deploy task that just runs wordpress-deploy. If your project has multiple deploy targets, you can simply re-alias the deploy task.

Using Gilded WordPress

It's sometimes useful to have direct access to the Gilded WordPress module. You could install Gilded WordPress as a dependency alongside grunt-wordpress, but in order to guarantee that you're loading the same version, grunt-wordpress exposes its own dependency. Simply require( "grunt-wordpress" ) and you'll get the Gilded WordPress module.

Permissive Uploads

Depending on what resources you're uploading, you may need to change some WordPress settings. See the Gilded WordPress documentation for some settings that might help.

License

Copyright Scott González. Released under the terms of the MIT license.


Support this project by donating on Gratipay.