GithubHelp home page GithubHelp logo

grunt-wordpress's Introduction

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"
	}
});
  • url: The URL for the WordPress install. Can be a full URL, e.g., http://wordpress.dev:123/some/path or as short as just the host name. If the protocol is https, then a secure connection will be used.
  • host (optional): The actual host to connect to if different from the URL, e.g., when deploying to a local server behind a firewall.
  • username: WordPress username.
  • password: WordPress password.
  • dir: Directory containing posts, taxonomies, and resources.

Tasks

wordpress-validate

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

  • Verifying that XML-RPC is enabled for the WordPress site.
  • Verifying that the custom XML-RPC methods for gilded-wordpress are installed.
  • Verifying the taxonomies and terms in taxonomies.json.
  • Verifying that child-parent relationships for posts are valid.
  • Verifying data for each post.

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.

grunt-wordpress's People

Contributors

jzaefferer avatar kborchers avatar pdehaan avatar rdworth avatar scottgonzalez avatar staabm avatar supertassu 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  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  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  avatar

Watchers

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

grunt-wordpress's Issues

Sync resources

Unlike posts, deleted resources don't get unpublished.

Prevent from deleting / Syncing specific post types

Hey!

Thanks for the library.

Is there a way we can prevent from deleting existing posts in remote Wordpress installation, that are not present locally?

For example, I have locally the only file /wp/posts/post/test-post.html, and I want to sync only this specific post.

However after running wordpress-sync, sample-page page and hello-world post are deleted.

It also would be fine, if I could sync a specific post type.

For example after running wordpress-sync, hello-world post gets deleted, while sample-page remains untouched.

Thanks a lot!

Change order of deployment

The wordpress-sync task currently runs wordpress-sync-terms, then wordpress-sync-posts, then wordpress-sync-resources. This means that a post can be updated and link to a resource that hasn't been published yet. To prevent this problems, the sync tasks should be split. I think the right order is:

  1. Add/edit terms
  2. Add/edit resources
  3. Add/edit posts
  4. Remove posts
  5. Remove resources
  6. Remove terms

Multisite Compatibility

@scottgonzalez - Amazing Grunt plugin you have here!

This is either a feature request or a documentation request, not sure which.

Can you specify exactly how to create a new site within a Multisite instance? I can see myself using the other functionalities you've got here, but right now my first priority is generating an array of site instances in multisite for new devs that hav recently cloned my project. Can you shed some light?

CLI flag for config file

Currently I edit a grunt.js file whenever I want to use a different configuration to deploy to staging. I then need to remember to undo that change, and not commiting it with others.

Currently the config file is actually inside each grunt.js file - I wouldn't really want to duplicate the flag thing across all our projects using grunt-wordpress, and there's also the problem of passing arguments from one task to another. We'd probably need a custom task here then updates the configuration before scheduling the deploy task to run.

Maybe @rdworth or @cowboy have some input here as well?

Need to be able to force a different IP than the DNS for a server.

Rather than overriding /etc/hosts on machines, if the target WordPress install is behind a firewall, it's harder to get xmlrpc working cleanly.

It would be nice to be able to offer an alternate hostname/ip than what DNS would provide I.E.:

{
  "url": "jquery.com",
  "host": "internal-private-server.jquery.com"
}

Error: XML-RPC fault: The page template is invalid.

Steps to reproduce

  1. Check out web-base-template new-css
  2. Check out qunitjs.com new-css
  3. grunt deploy
  4. Check out web-base-template master
  5. Check out qunitjs.com master
  6. grunt deploy
Running "wordpress-sync" task
Edited page cookbook.
>> Error editing page extensions...
>> Error: XML-RPC fault: The page template is invalid.
<WARN> Task "wordpress-sync" failed. Use --force to continue. </WARN>

If you then repeat step 6 above (grunt deploy) it completes without error

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.