Skip to content

Commit 88bcd07

Browse files
committed
Build: Replace ensure-wordpress-config with more direct assignment
This is the same, simpler, approach as utilised at <https://github.com/jquery/api.jquery.com/blob/v3.1.0/Gruntfile.js>.
1 parent 7dad0a3 commit 88bcd07

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

Gruntfile.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ grunt.initConfig( {
2222
dest: "dist/resources/sri-directives.json"
2323
}
2424
}
25-
}
25+
},
26+
27+
wordpress: (function() {
28+
29+
// This fails with "Cannot find module" if the file does not exist
30+
var config = require( "./config" );
31+
config.dir = "dist/wordpress";
32+
return config;
33+
})()
2634
} );
2735

2836
grunt.registerTask( "build-index", function() {
@@ -453,22 +461,12 @@ grunt.registerTask( "ensure-dist-resources", function() {
453461
grunt.file.mkdir( "dist/resources" );
454462
} );
455463

456-
grunt.registerTask( "ensure-wordpress-config", function() {
457-
// This will fail with "Cannot find module" if the file
458-
// does not exist
459-
var config = require( "./config" );
460-
config.dir = "dist/wordpress";
461-
grunt.config.merge( {
462-
wordpress: config
463-
} );
464-
} );
465-
466464
grunt.registerTask( "sri-generate", ["ensure-dist-resources", "sri:generate"] );
467465

468466
// The "grunt deploy" command is automatically invoked on git-commit by the server that
469467
// will deploy the WordPress site.
470468
// Task tree: "deploy" > "wordpress-deploy" > "build-wordpress" > "build".
471469
grunt.registerTask( "build", ["sri-generate", "build-index"] );
472-
grunt.registerTask( "deploy", ["ensure-wordpress-config", "wordpress-deploy", "reload-listings"] );
470+
grunt.registerTask( "deploy", ["wordpress-deploy", "reload-listings"] );
473471

474472
};

0 commit comments

Comments
 (0)