|
1 | 1 | var rimraf = require( "rimraf" ),
|
2 |
| - spawnback = require( "spawnback" ); |
| 2 | + spawnback = require( "spawnback" ), |
| 3 | + jqueryContent = require( "grunt-jquery-content" ); |
3 | 4 |
|
4 | 5 | module.exports = function( grunt ) {
|
5 | 6 |
|
6 | 7 | grunt.loadNpmTasks( "grunt-check-modules" );
|
7 | 8 | grunt.loadNpmTasks( "grunt-jquery-content" );
|
8 |
| -grunt.loadNpmTasks( "grunt-wordpress" ); |
9 | 9 |
|
10 | 10 | grunt.initConfig({
|
11 | 11 | "build-pages": {
|
12 |
| - all: grunt.file.expandFiles( "page/**" ) |
| 12 | + all: "page/**" |
13 | 13 | },
|
14 | 14 | "build-resources": {
|
15 |
| - all: grunt.file.expandFiles( "resources/**/*" ) |
| 15 | + all: "resources/**" |
16 | 16 | },
|
17 |
| - wordpress: grunt.utils._.extend({ |
18 |
| - dir: "dist/wordpress" |
19 |
| - }, grunt.file.readJSON( "config.json" ) ) |
| 17 | + wordpress: (function() { |
| 18 | + var config = require( "./config" ); |
| 19 | + config.dir = "dist/wordpress"; |
| 20 | + return config; |
| 21 | + })() |
20 | 22 | });
|
21 | 23 |
|
22 | 24 | grunt.registerTask( "clean", function() {
|
@@ -117,26 +119,26 @@ function contributorAttribution( post, fileName, callback ) {
|
117 | 119 | value: JSON.stringify( contribs )
|
118 | 120 | });
|
119 | 121 |
|
120 |
| - callback( null ); |
| 122 | + callback( null, post ); |
121 | 123 | });
|
122 | 124 | }
|
123 | 125 |
|
124 |
| -grunt.registerHelper( "build-pages-preprocess", (function() { |
| 126 | +jqueryContent.preprocessPost = (function() { |
125 | 127 | var orderMap = getOrderMap();
|
126 | 128 |
|
127 |
| - return function( post, fileName, done ) { |
128 |
| - var slug = fileName.replace( /^.+?\/(.+)\.\w+$/, "$1" ), |
| 129 | + return function( post, postPath, callback ) { |
| 130 | + var slug = postPath.replace( /^.+?\/(.+)\.\w+$/, "$1" ), |
129 | 131 | menuOrder = orderMap[ slug ];
|
130 | 132 |
|
131 | 133 | if ( menuOrder ) {
|
132 | 134 | post.menuOrder = menuOrder;
|
133 | 135 | }
|
134 | 136 |
|
135 |
| - contributorAttribution( post, fileName, done ); |
| 137 | + contributorAttribution( post, postPath, callback ); |
136 | 138 | };
|
137 |
| -})()); |
| 139 | +})(); |
138 | 140 |
|
139 |
| -grunt.registerTask( "build", "build-pages build-resources" ); |
140 |
| -grunt.registerTask( "build-wordpress", "check-modules clean build" ); |
| 141 | +grunt.registerTask( "build", [ "build-pages", "build-resources" ] ); |
| 142 | +grunt.registerTask( "build-wordpress", [ "check-modules", "clean", "build" ] ); |
141 | 143 |
|
142 | 144 | };
|
0 commit comments