-
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
Conversation
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 comment
The reason will be displayed to describe this comment to others. Learn more.
} );
?
var wp = require( "wordpress" ); | ||
|
||
grunt.registerTask( "redirects", function() { | ||
var config = grunt.config( "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.
We don't really do onevar anymore (jquery/contribute.jquery.org#105)
5c619e2
to
16714f3
Compare
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Under the hood grunt.file.readJSON
just reads a file and JSON.parse
's it, so it seemed kinda strange that we're directly JSON.stringify
ing it again.
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.
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough.
Looks alright, along with jquery/jquery-wp-content#368 |
I've tested with qunitjs.com, works fine: qunitjs/qunitjs.com#103 |
Would allow us to add a
redirects.json
in the following format:Closes #61