Skip to content

Commit 81579ec

Browse files
committed
Redirects: Add support for setting redirects in redirects.json
Ref #61 Closes gh-69
1 parent 3f94a5d commit 81579ec

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"marked": "0.3.2",
3030
"rimraf": "2.2.8",
3131
"spawnback": "1.0.0",
32-
"which": "1.0.5"
32+
"which": "1.0.5",
33+
"wordpress": "0.1.3"
3334
},
3435
"devDependencies": {
3536
"grunt": "0.4.5",

tasks/redirects.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = function( grunt ) {
2+
3+
var wp = require( "wordpress" );
4+
5+
grunt.registerTask( "deploy-redirects", function() {
6+
var config = grunt.config( "wordpress" );
7+
var redirects = grunt.file.exists( "redirects.json" ) ? grunt.file.readJSON( "redirects.json" ) : {};
8+
var client = wp.createClient( config );
9+
10+
client.authenticatedCall( "jq.setRedirects", JSON.stringify( redirects ), this.async() );
11+
} );
12+
13+
grunt.registerTask( "deploy", [ "wordpress-deploy", "deploy-redirects" ] );
14+
15+
};

0 commit comments

Comments
 (0)