Skip to content

Commit 6e13f6e

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 0f5a3bd commit 6e13f6e

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Gruntfile.js

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

2634
grunt.registerTask( "build-index", function() {
@@ -451,22 +459,12 @@ grunt.registerTask( "ensure-dist-resources", function() {
451459
grunt.file.mkdir( "dist/resources" );
452460
} );
453461

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

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

472470
};

0 commit comments

Comments
 (0)