-
Notifications
You must be signed in to change notification settings - Fork 32
Redirects: Add support for setting redirects in redirects.json #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = function( grunt ) { | ||
|
||
var wp = require( "wordpress" ); | ||
|
||
grunt.registerTask( "deploy-redirects", function() { | ||
var config = grunt.config( "wordpress" ); | ||
var redirects = grunt.file.exists( "redirects.json" ) ? grunt.file.readJSON( "redirects.json" ) : {}; | ||
var client = wp.createClient( config ); | ||
|
||
client.authenticatedCall( "jq.setRedirects", JSON.stringify( redirects ), this.async() ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Under the hood There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or is this just because we can catch syntax errors in the file more easily this way? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly, I wanted grunt to error on invalid JSON. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. |
||
} ); | ||
|
||
grunt.registerTask( "deploy", [ "wordpress-deploy", "deploy-redirects" ] ); | ||
|
||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the latest release is 1.1.0, why such an old version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the same version in use in grunt-wordpress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. Yeah. That makes sense.